From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756032AbbIWVyu (ORCPT ); Wed, 23 Sep 2015 17:54:50 -0400 Received: from one.firstfloor.org ([193.170.194.197]:45436 "EHLO one.firstfloor.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754385AbbIWVyt (ORCPT ); Wed, 23 Sep 2015 17:54:49 -0400 Date: Wed, 23 Sep 2015 23:54:47 +0200 From: Andi Kleen To: Rasmus Villemoes Cc: Andi Kleen , tytso@mit.edu, linux-kernel@vger.kernel.org, kirill.shutemov@linux.intel.com, herbert@gondor.apana.org.au, Andi Kleen Subject: Re: [PATCH 1/3] Make /dev/urandom scalable Message-ID: <20150923215447.GJ1747@two.firstfloor.org> References: <1442963767-14945-1-git-send-email-andi@firstfloor.org> <87r3lpo27e.fsf@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87r3lpo27e.fsf@rasmusvillemoes.dk> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > +{ > > + struct entropy_store *pool = &nonblocking_pool; > > + > > + /* > > + * Non node 0 pools may take longer to initialize. Keep using > > + * the boot nonblocking pool while this happens. > > + */ > > + if (nonblocking_node_pool) > > + pool = nonblocking_node_pool[numa_node_id()]; > > + if (!pool->initialized) > > + pool = &nonblocking_pool; > > + return pool; > > +} > > I assume this can't get called concurrently with rand_initialize > (otherwise pool may be NULL even if nonblocking_node_pool is non-NULL). Yes. I can move the assignment to the global last and add a memory barrier. > > + char name[40]; > > + > > + nonblocking_node_pool = kzalloc(num_nodes * sizeof(void *), > > + GFP_KERNEL|__GFP_NOFAIL); > > + > > Why kzalloc, when you immediately initialize all elements? New uses of > __GFP_NOFAIL seem to be frowned upon. How hard would it be to just fall > back to only using the single statically allocated pool? It's already doing that. > > Does rand_initialize get called before or after other initialization > code updates node_possible_map to reflect the actual possible number of > nodes? If before, won't we be wasting a lot of memory (not to mention > that we then might as well allocate all the nonblocking pools statically > based on MAX_NUMNODES). I'll check. -Andi -- ak@linux.intel.com -- Speaking for myself only.