From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTXoG-0003m1-4Z for qemu-devel@nongnu.org; Wed, 10 Feb 2016 11:40:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTXoC-0005WF-VQ for qemu-devel@nongnu.org; Wed, 10 Feb 2016 11:40:08 -0500 Received: from mx5-phx2.redhat.com ([209.132.183.37]:56251) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTXoC-0005WA-Nj for qemu-devel@nongnu.org; Wed, 10 Feb 2016 11:40:04 -0500 Date: Wed, 10 Feb 2016 11:40:03 -0500 (EST) From: Ladi Prosek Message-ID: <51909770.35566233.1455122403597.JavaMail.zimbra@redhat.com> In-Reply-To: <56BB641F.3020104@redhat.com> References: <1455119605-31261-1-git-send-email-lprosek@redhat.com> <1455119605-31261-5-git-send-email-lprosek@redhat.com> <56BB641F.3020104@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 4/4] rng: add request queue support to rng-random List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: amit shah , pagupta@redhat.com, qemu-devel@nongnu.org > > > 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 > >