From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTXox-0004UE-Up for qemu-devel@nongnu.org; Wed, 10 Feb 2016 11:40:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTXou-0005iA-MM for qemu-devel@nongnu.org; Wed, 10 Feb 2016 11:40:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44828) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTXou-0005i2-2s for qemu-devel@nongnu.org; Wed, 10 Feb 2016 11:40:48 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 9215C91351 for ; Wed, 10 Feb 2016 16:40:47 +0000 (UTC) References: <1455119605-31261-1-git-send-email-lprosek@redhat.com> <1455119605-31261-5-git-send-email-lprosek@redhat.com> <56BB641F.3020104@redhat.com> <51909770.35566233.1455122403597.JavaMail.zimbra@redhat.com> From: Paolo Bonzini Message-ID: <56BB680B.7050304@redhat.com> Date: Wed, 10 Feb 2016 17:40:43 +0100 MIME-Version: 1.0 In-Reply-To: <51909770.35566233.1455122403597.JavaMail.zimbra@redhat.com> 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: Ladi Prosek Cc: amit shah , pagupta@redhat.com, qemu-devel@nongnu.org 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