qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 4/4] rng: add request queue support to rng-ra


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2 4/4] rng: add request queue support to rng-random
Date: Wed, 10 Feb 2016 17:40:43 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0


On 10/02/2016 17:40, Ladi Prosek wrote:
>>
>>
>> On 10/02/2016 16:53, Ladi Prosek wrote:
>>> +        req->size = size;
>>> +        req->receive_entropy = receive_entropy;
>>> +        req->opaque = opaque;
>>> +        req->data = g_malloc(req->size);
>>> +
>>> +        k->request_entropy(s, req);
>>> +
>>> +        s->requests = g_slist_append(s->requests, req);
>>>      }
>>
>> g_slist_append has to traverse the entire list to find the place to add
>> the node.  You probably are better off using QSIMPLEQ (which is an
>> intrusive list unlike GSList).
> 
> This is what rng-egd does today and I would argue that since the expected
> length of the list is very small - it's going to be longer than 1 only
> very rarely - a simple lightweight data structure is a better choice than
> trying to be O(1) in the worst case.
> 
> I'll be happy to switch to QSIMPLEQ if you want though. Your call.

Ok, it can be done on top I guess.  I'll let others review the patches
more closely!

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]