Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp646466lqp; Wed, 22 May 2024 15:46:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWMSZz0MSgMp1dhYYPQOvtpiKZGcxYSsrPVWSriOT8AtmaNES3CQSHjPeG2FIb7AiSxgg4mqAqjmzXCUdobzW586TMPw7KeQj1VQw2fiA== X-Google-Smtp-Source: AGHT+IGtbxxsZ++uzInAT6fAv8nBKu53mG0xX1AfX1tW8MLkEiTuJNxhMeDL4nOSRFIaWj90r8sx X-Received: by 2002:a05:6a21:329e:b0:1b1:dff2:ed03 with SMTP id adf61e73a8af0-1b1f8792259mr3857196637.16.1716418003616; Wed, 22 May 2024 15:46:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716418003; cv=pass; d=google.com; s=arc-20160816; b=DnBhQDzoFsBAnXODJuMl6kmNf+6kkZaEKrOaJU2ORCW9IqjPYHpK94rdav7+RU2bNu 3XZ0xOhlMoZN6ZpCRhFSaFdZF+y7T/UI31KVpcVOwAmdKRq1PZeuFf4rqoqXXOPkU000 y+9W55MbP3SNbYWhhv3ERwME97Fawf2myrUZluAmZWxX0xaze8p9QU74KhH2vajfV8Gj wa3HtRu3Q69fT8WUUphgInn/cSeDK0KvzL7a3rqGsc3d1YuzDucg3llVdQFJw/9k0QzY yFymUIeBKNETfQoPSvejIXl/un5ZrYYUg/+NJbSIJ3vZuT5gM9TIADQEjHjqEa266Pes 8xxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=rE/8eBPrx5XZFmDNeTv+2KViLdc0rjX6GgzcWxZCAKA=; fh=WmoaGhU50LJjTz2QpH4YkLM6mk47CCvD7AffxHLszp0=; b=U2zRyRvUmsN+MYL9mQaXLvtOaHtp1ogZN6zs1zFHzC7GQkM5fUpTl4Bapi+qHKTUDi 1NZhXrCiVSfdRwBZA5ntT0jZWSBlw0Qt5wAmSIfHr2WUoLV4BcBsgLe+iWwtCqwMlU2I Wu8d+tqn4h1fN2d69uBz5hjGqyidkN/n3yZOD8vCZtWO4R7fuXf2gKpdhK2NEdX3mS2N xCzQCnDMjR5yDHAzWIdBwf2Ew12hPNjMP3FIc+K7UJjkRuOhlNCOgkCvBVsnW3LZqfuP GnElxZCRZIQQ98zgGgybQln9j7MeixEtFiR38zFutyNy0jBIG8jNMjX64xMtp96fct7g TXEQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=Difkpi8p; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-186788-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186788-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-662afcce1afsi3750290a12.115.2024.05.22.15.46.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 15:46:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186788-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=Difkpi8p; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-186788-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186788-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 79A1B2823F8 for ; Wed, 22 May 2024 22:46:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 75A5F1487E8; Wed, 22 May 2024 22:46:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="Difkpi8p" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8F2A541A80; Wed, 22 May 2024 22:46:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716417969; cv=none; b=l3z0mx87XtvQIOydhX4bs+J0GrmsnwxK/sqyi5ZB9ZwdsQAhemz5cyxKSIjZLaQA4OkWVOVOJdpPzSnrtjhOLKdOqJR48OYvLA/hTw8jHbJ8fOe7GzGigm1tP+koY8M3E8JqU7SODsFLRR1miO8ogs0KOKw+ygEtvxXOjXAx7K0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716417969; c=relaxed/simple; bh=Wt/lYOMjZ5EiLqgZDOMSYLAv6ghVbecXbWEEUnbdvAk=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=I8ley0LEtGN3PubbW8F/1VlsVW4cBCTy/Je3OK1HaJqftPWDz1O0UFruzsh+cZQ4hdzyfYyB0Gc21YQ8ZN5szw0UROkEfXNVOy0qle6DNvKVL/AqLMijXOA3tWaeBnkA/UhnLi4RzFxLrliUY06dKEJig74iWGGX06ejQ+89Gag= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=Difkpi8p; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A11A8C2BBFC; Wed, 22 May 2024 22:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1716417969; bh=Wt/lYOMjZ5EiLqgZDOMSYLAv6ghVbecXbWEEUnbdvAk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Difkpi8pE8zKRNDX2+VZ7EyZcNiHjM0HR8FJLGZH0pip8MxP1u7thd/rd83PcA09V TVYuNLsB9uDO/0L6O8a4XCtYe8AGfV2GMFw/WHUCsVYFKPfQALg/JlSvIlzFXcExDp AtnoA3XHUlrJl32QhYOsFNsXhIwLTMDFKtCKGeoA= Date: Wed, 22 May 2024 15:46:07 -0700 From: Andrew Morton To: Eric Chanudet Cc: Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Mike Rapoport , Baoquan He , Michael Ellerman , Nick Piggin , x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v2] mm/mm_init: use node's number of cpus in deferred_page_init_max_threads Message-Id: <20240522154607.bd5790c0b0dc642aefd3a05c@linux-foundation.org> In-Reply-To: <20240522203758.626932-4-echanude@redhat.com> References: <20240522203758.626932-4-echanude@redhat.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 22 May 2024 16:38:01 -0400 Eric Chanudet wrote: > x86_64 is already using the node's cpu as maximum threads. Make that the > default for all archs setting DEFERRED_STRUCT_PAGE_INIT. > > This returns to the behavior prior making the function arch-specific > with commit ecd096506922 ("mm: make deferred init's max threads > arch-specific"). > It isn't clear to me what is the runtime effect of this change upon our users. Can you please prepare a sentence which spells this out? > > --- > 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%) | The above is useful info, I'll hoist it into the main changelog. > --- a/mm/mm_init.c > +++ b/mm/mm_init.c > @@ -2126,7 +2126,7 @@ deferred_init_memmap_chunk(unsigned long start_pfn, unsigned long end_pfn, > __weak int __init > deferred_page_init_max_threads(const struct cpumask *node_cpumask) > { > - return 1; > + return max_t(int, cpumask_weight(node_cpumask), 1); > } It's an unrelated cleanup , but that could be max(cpumask_weight(node_cpumask), 1U); and the function could/should return unsigned.