Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp353243lqp; Wed, 22 May 2024 06:41:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWvVzLuT91RWyexsSBcdiG0SjW2PNl4Y7PAJOt0iVuUCjOwR1F13KqG+krQgczRKoYx3dt6mwmliL/ZrMQ9GGciw5QVLVq7x9WCJBjS7A== X-Google-Smtp-Source: AGHT+IH5fF4a4LDQqnDXF97N7YMwJ2BIaHPpQPJt0HS4XMSSCv18JLGLmsS8HTtFVz/W6K9Cbx6c X-Received: by 2002:a05:6214:450f:b0:6aa:3dc9:4b2 with SMTP id 6a1803df08f44-6ab7f34a5eemr21022826d6.5.1716385282325; Wed, 22 May 2024 06:41:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716385282; cv=pass; d=google.com; s=arc-20160816; b=E1GPQDNsWAor+Zu7FQqYYUvCHGXI0UJNEqBDHPj2zrFu1TdOeq2nhGCzUPazR5ZlSC +Yz3E4IeI4Tvx+sTA7w73LAQih4s9z2slBVEkFiY/K0EJ3mkiZDJ580upYteElDpQC0B xATB6oWFNN+it34UVWD+hSqwr10VGGjNydKeRp9uBdvSYSlByrRBgCWQZi1b0s1gRzX0 4R/iGBk0VQ7a4UjMkrDVywVym1adctUa+3sYMsEGzLoaDxVZ6jiKGGKEXeGENN7U2M0k IpTnXqMM1m2GhyjQ8nXJ8UGHsNrEG2jIIGbjgUBHkRLD5B1hdes4iEy+/MTDP1x5QAsC 7gOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=8/PBiZvFrBuII36XLpoKvRmLCaJ3SFHh2NHdHOARiBY=; fh=FU8xIqDuCJtWfIIQI6//YGuJTH1QPhi2doJKbQAgvxQ=; b=uGXNtDhrhTLxd7etGsU3bJhWkBRa0kv7w2MKrwHAc4AjwtWPRATn+JNdXu1dGAIjWE 131TrXKe3hi4POK9YSX1Is8+P06PEHC9/R3Eio1RcL/hjdEJ9i15c8NrmyCqKmoGKhGY dRQy7ONneduGRsVJrTa8pYhSIQL0+LH0yyir3rJ6PW5UiPvUoeu9iAQSM3NBjhpqM0M9 BxBSRMFUia6JwA9q5vjM5a1KleJseCmRUD52f16/V55sUCfrzNDtncoNZkJXwFHvJYoP kamMnJvN9efdyBwO201/LBrU7RqEt+G1pSKPmCVe4kWNx+YFieYl3r5SMqcIesO3uFZW NlKA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=MGok1PkO; arc=pass (i=1 spf=pass spfdomain=ellerman.id.au dkim=pass dkdomain=ellerman.id.au); spf=pass (google.com: domain of linux-kernel+bounces-186294-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186294-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f29ca65si86207106d6.268.2024.05.22.06.41.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 06:41:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186294-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=MGok1PkO; arc=pass (i=1 spf=pass spfdomain=ellerman.id.au dkim=pass dkdomain=ellerman.id.au); spf=pass (google.com: domain of linux-kernel+bounces-186294-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186294-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 138B51C22820 for ; Wed, 22 May 2024 13:41:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F44C14038A; Wed, 22 May 2024 13:41:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="MGok1PkO" Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 657E313FD91 for ; Wed, 22 May 2024 13:41:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=150.107.74.76 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716385275; cv=none; b=sBwXd9ulESHP372cYwYmiAD7b08DRRPukDUaXQJvVUW7OqWxBCxbK2sj30XFd3ope8g8Fag0L8OZ96bsPtgU3U2J3ai4D5YHQU5UYLAzdhbaArgqk6cqrPZHQ9SZAIVTtDi055mpEXSpe7U1KlY6vncQmrbp0SDtbG3namzjwa4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716385275; c=relaxed/simple; bh=JILr1T+P3F3NBN+I1zA7Db/3TKsKONL/5zEv0TIf1W4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=nFCdvTXqleUlnFJ333Q/5A++f/mqKosDjzEuuzBTglHjYi/B2qxK53XepzTAysaNLdFoaOPfG+h5lcLu9vpbmlSXDGWn2u/1DtnP+Lhorcr7xOxGpibS7nvVcnkh2FOxMnxAQfYniPv9VBmYOjZlkdAubQEgIUsVfDdDDSc5//4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au; spf=pass smtp.mailfrom=ellerman.id.au; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b=MGok1PkO; arc=none smtp.client-ip=150.107.74.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ellerman.id.au DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1716385269; bh=8/PBiZvFrBuII36XLpoKvRmLCaJ3SFHh2NHdHOARiBY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=MGok1PkOYR3nLYgp2li4zheiWLLmwM4Y+kBrvn+tV7pn1awxPXSoeQ54DxwYVsaja 1UWbN6lPGeu3PmJJrNE5EbUBm3eo7ie9TJDDzS9Tpq0JrpWUOXLP7hZL3blpQ6gxdO S5Bz4IcYZh6CDuGTjp5aS2jG4ZgYj0iI+irkVpjI2NizSMSYppN+jR56rb6344idnG qjj4sGLYCEUbV24RTvU82karag+LMEAlbYzrfv3s7aCHJ0da4HnnIMNZT3GlI1XhQn j8gGhZbeBIZ+Ka9piZznvA3dvyIfexnFy0sZUuMdlfFRFCEPMlMdIW+kIaFIXon21V muU/jdiNaS+lA== Received: from authenticated.ozlabs.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 mail.ozlabs.org (Postfix) with ESMTPSA id 4Vkss031vVz4wcq; Wed, 22 May 2024 23:41:08 +1000 (AEST) From: Michael Ellerman To: Eric Chanudet , Mike Rapoport Cc: Catalin Marinas , Will Deacon , Baoquan He , Andrew Morton , Zhen Lei , Yajun Deng , Zhang Jianhua , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Nick Piggin Subject: Re: [PATCH] arm64: init: override deferred_page_init_max_threads In-Reply-To: References: <20240520231555.395979-5-echanude@redhat.com> Date: Wed, 22 May 2024 23:41:07 +1000 Message-ID: <87plte2ccs.fsf@mail.lhotse> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Eric Chanudet writes: > On Tue, May 21, 2024 at 07:10:07PM +0300, Mike Rapoport wrote: >> (added powerpc folks) Thanks Mike. >> On Mon, May 20, 2024 at 07:15:59PM -0400, Eric Chanudet wrote: >> > This was the behavior prior to making the function arch-specific with >> > commit ecd096506922 ("mm: make deferred init's max threads >> > arch-specific") >> > >> > Architectures can override the generic implementation that uses only one >> > CPU. Setting DEFERRED_STRUCT_PAGE_INIT and testing on a few arm64 >> > platforms shows faster deferred_init_memmap completions: >> > >> > | | x13s | SA8775p-ride | Ampere R137-P31 | Ampere HR330 | >> > | | Metal, 32GB | VM, 36GB | VM, 58GB | Metal, 128GB | >> > | | 8cpus | 8cpus | 8cpus | 32cpus | >> > |---------|-------------|--------------|-----------------|--------------| >> > | threads | ms (%) | ms (%) | ms (%) | ms (%) | >> > |---------|-------------|--------------|-----------------|--------------| >> > | 1 | 108 (0%) | 72 (0%) | 224 (0%) | 324 (0%) | >> > | cpus | 24 (-77%) | 36 (-50%) | 40 (-82%) | 56 (-82%) | How did you measure this, just some printks in page_alloc_init_late() or something more sophisticated? Just so I can do some comparable measurements. >> > diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c >> > index 9b5ab6818f7f..71f5188fe63d 100644 >> > --- a/arch/arm64/mm/init.c >> > +++ b/arch/arm64/mm/init.c >> > @@ -158,6 +158,13 @@ static void __init zone_sizes_init(void) >> > free_area_init(max_zone_pfns); >> > } >> > >> > +#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT >> > +int __init deferred_page_init_max_threads(const struct cpumask *node_cpumask) >> > +{ >> > + return max_t(int, cpumask_weight(node_cpumask), 1); >> > +} >> > +#endif >> > + >> >> Maybe we should make this default and let architectures that want a single >> thread override deferred_page_init_max_threads() to return 1? > > It would affect more archs than I can try this on. Currently, only x86 > (with this change, arm64) return more than one thread. I can test powerpc and we can find someone to test s390. No other arches have it enabled in their defconfig. > I'm happy to send a v2 inverting the logic if you find it preferable. That seems preferable. It's a scalability feature, it makes no sense for the default to be a single thread AFAICS. cheers