From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1D1BC36002 for ; Wed, 9 Apr 2025 07:47:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C13526B010E; Wed, 9 Apr 2025 03:47:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B722E6B0112; Wed, 9 Apr 2025 03:47:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9C5CB6B010F; Wed, 9 Apr 2025 03:47:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 7A83A6B014C for ; Wed, 9 Apr 2025 03:47:52 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id ABE8EB0D82 for ; Wed, 9 Apr 2025 07:47:53 +0000 (UTC) X-FDA: 83313726426.04.74BD9B4 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf01.hostedemail.com (Postfix) with ESMTP id 683664000A for ; Wed, 9 Apr 2025 07:47:51 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=tRynlPlO; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=L2v61w+1; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=jNU4c1QH; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=HoKK+z0P; spf=pass (imf01.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1744184871; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=90MK+irpo/1NrJ2v//Z0/aUKi6mvSl/+9YGuQGvtMj8=; b=Pm4Xi7S5brvgPZeaIB8OPa0yCHSgxqgoT90YHWAGY3DNsZhhwZAbXlZCsHtk0S739I81aH 5uA5pF/T8A2krdEpS8gA8+8AuD91gYnD5GbhXrqPK+8Sw224iPDaUm6p34WiOFiIgZvyBo ylKo7AdIl8cZuBvUgFxP75i8oSUU6d0= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=tRynlPlO; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=L2v61w+1; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=jNU4c1QH; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=HoKK+z0P; spf=pass (imf01.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744184871; a=rsa-sha256; cv=none; b=QE2/OcbWDwY9y0ILFM3BnVMju52Fg4OrIVImgidezR66dhMtroawKnP9LGMkiRYPbyJSgw EZJb+PT6MDqa1zN0STW62aE91ajYgSkROQ3FnzubY/AwDSDYiaAMsK+DVw/b+fdKKQ7Yq/ d/0fK5ZAVDN2HBOQAVQW5jwvOt+iQvw= Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7B7D91F388; Wed, 9 Apr 2025 07:47:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744184869; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=90MK+irpo/1NrJ2v//Z0/aUKi6mvSl/+9YGuQGvtMj8=; b=tRynlPlOIkBgbtlLrAX+C/I5K5U5I6U56ECwufmx77PUvdl0URL22LIcSuNoPA8xOCE38j e60jXUT5XOCqyeSvy7PHQGtogICoiPKiKxCss7spHHqCVmEMvU4ZBEaMZ41eeKU9XvcA3q LJrMrHHSeZ9fVra4Lo+tmv83Hlix/ok= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744184869; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=90MK+irpo/1NrJ2v//Z0/aUKi6mvSl/+9YGuQGvtMj8=; b=L2v61w+1yYoBsIuABbt0IjXvrOmkm4TJeKmYzyC9RL4509v7OphaQaD1VzzCMRI5NAnU63 kWdAeUDvN4dTsICA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1744184867; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=90MK+irpo/1NrJ2v//Z0/aUKi6mvSl/+9YGuQGvtMj8=; b=jNU4c1QHM1/sw7aKJ/1ZsVWDbhKoXnjahVEy4GXKoW2Zt6nvbQGAupCHpbIoyqkBeJyg77 0nlTp5ACmvGAtoxNteAw3kAe+Lc72Q7fVIpVRbOmA1d8Jc0ZtNl7VJzhMYCvzPF5frjci3 rSG85GO/digkZ+9mVg9+TZgXx0BRbNo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1744184867; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=90MK+irpo/1NrJ2v//Z0/aUKi6mvSl/+9YGuQGvtMj8=; b=HoKK+z0PM0xfwiTjpGCXwks+UGzg0XI/BZl/mDcAeyRBh43I9CFUgQ9SGvcLmxQIG3AjA2 K8HxYzvMLVn2/DBA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 06E3F137AC; Wed, 9 Apr 2025 07:47:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id W8N5OiIm9mcWUQAAD6G6ig (envelope-from ); Wed, 09 Apr 2025 07:47:46 +0000 Date: Wed, 9 Apr 2025 09:47:45 +0200 From: Oscar Salvador To: Frank van der Linden Cc: akpm@linux-foundation.org, muchun.song@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, david@redhat.com, luizcap@redhat.com Subject: Re: [PATCH] mm/hugetlb: use separate nodemask for bootmem allocations Message-ID: References: <20250402205613.3086864-1-fvdl@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250402205613.3086864-1-fvdl@google.com> X-Rspamd-Action: no action X-Rspamd-Queue-Id: 683664000A X-Rspamd-Server: rspam05 X-Rspam-User: X-Stat-Signature: cjfsq6bnssqum8ippp8q9dnmm7opzngr X-HE-Tag: 1744184871-449278 X-HE-Meta: U2FsdGVkX18pKf0yu1PC2ADdsklDKhRIf5I/REHfgvD8PQ1rNWoe0CgOl/5vHLxq7xGY1GnYXbZMmcV10ezhYmym08H8T0LyKu+rkvdHAC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mXAnJxsnW0tqGDW4mDCMEIBS/ffY5QQ/PLZe4lzoEe0blQUkLU4RBf4/ZqMnAY1x7DUtS9k8JvxPXkKk39QGb5jRAJkC2HxR X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Apr 02, 2025 at 08:56:13PM +0000, Frank van der Linden wrote: > Hugetlb boot allocation has used online nodes for allocation since > commit de55996d7188 ("mm/hugetlb: use online nodes for bootmem > allocation"). This was needed to be able to do the allocations > earlier in boot, before N_MEMORY was set. > > This might lead to a different distribution of gigantic hugepages > across NUMA nodes if there are memoryless nodes in the system. > > What happens is that the memoryless nodes are tried, but then > the memblock allocation fails and falls back, which usually means > that the node that has the highest physical address available > will be used (top-down allocation). While this will end up > getting the same number of hugetlb pages, they might not be > be distributed the same way. The fallback for each memoryless > node might not end up coming from the same node as the > successful round-robin allocation from N_MEMORY nodes. > > While administrators that rely on having a specific number of > hugepages per node should use the hugepages=N:X syntax, it's > better not to change the old behavior for the plain hugepages=N > case. > > To do this, construct a nodemask for hugetlb bootmem purposes > only, containing nodes that have memory. Then use that > for round-robin bootmem allocations. > > This saves some cycles, and the added advantage here is that > hugetlb_cma can use it too, avoiding the older issue of > pointless attempts to create a CMA area for memoryless nodes > (which will also cause the per-node CMA area size to be too > small). > > Fixes: de55996d7188 ("mm/hugetlb: use online nodes for bootmem allocation") > Signed-off-by: Frank van der Linden This looks good to me Reviewed-by: Oscar Salvador The only think I was pondering whether it would be a way to keep hugetlb_bootmem_set_nodes() confined in hugetlb code and not having to export that to hugetlb_cma. But then again, you would have to create a function that calls hugetlb_bootmem_set_nodes() earlier and would be churn for churn. -- Oscar Salvador SUSE Labs