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: Ladi Prosek
Subject: Re: [Qemu-devel] [PATCH v2 4/4] rng: add request queue support to rng-random
Date: Wed, 10 Feb 2016 11:40:03 -0500 (EST)

> 
> 
> 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.

Thanks!
Ladi
 
> Thanks,
> 
> Paolo
> 
> 



reply via email to

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