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 0D77AC25B7C for ; Wed, 22 May 2024 22:46:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 690C06B0085; Wed, 22 May 2024 18:46:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 63FAB6B0088; Wed, 22 May 2024 18:46:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 506F66B0089; Wed, 22 May 2024 18:46:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 318956B0085 for ; Wed, 22 May 2024 18:46:13 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 86ED740B4F for ; Wed, 22 May 2024 22:46:12 +0000 (UTC) X-FDA: 82147516584.23.996B8CB Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id BF25C140020 for ; Wed, 22 May 2024 22:46:10 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=Difkpi8p; dmarc=none; spf=pass (imf09.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716417970; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rE/8eBPrx5XZFmDNeTv+2KViLdc0rjX6GgzcWxZCAKA=; b=YkPs1KDPFOS2HnUzDMEs3cCjHii813zmfYTq6su8RX0K/W6pxsR05MIJ4x6Ihx4mVDh9lU lGhZWr54hgZ9r+TC9HsKhwhLFrkc6yyhaQs4hy2X6XAQrXfdw4XhmCyIAbfIkg04TaU11d ZnXF14Hmkwi8OrPYetBop3shcYCDi1E= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=Difkpi8p; dmarc=none; spf=pass (imf09.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716417970; a=rsa-sha256; cv=none; b=yPTQVsC8p4Kwv2GihgIMDS6LtbON/XziytSmxgwXL8R5FufcgF5M7VTe7ThGFd8TbYOF6g freiyMQzwsydYpmDAnkL5eDMNBW44m+X4kJBeG1yk9NxPcTQz+rkuzc4tEqWQdJW1fcdem V7T0WrI+uCFCphgwWatclkCF31XH+Gg= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 8EB1B62B44; Wed, 22 May 2024 22:46:09 +0000 (UTC) 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) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: BF25C140020 X-Stat-Signature: d8rb15mwuo7ia3kf6ua8cu459eyjka6x X-HE-Tag: 1716417970-899039 X-HE-Meta: U2FsdGVkX1+S0Ujy2jzYi4EyPYhXOoWBV1UXvvV+tIE7C1mx2jFVpSHnSfEalTqZcHoUSE3ygnI21yU1NcRsVAYSdqC0s12mbIiGqo483tjDbkg1H04kiLqnvV9X6dU6V3Wjm990UHaEtavVvACwJw+lLxEQDNVUgjmRSxH5tAyNr3X31oMiHT+QoO518V9EWaeYDItO7FiYQin9sLse7E/voFxZeXCf2sVqx8nz9siU/soSQlHkkApHqz9IuE2OQ9g7OQU6oNDD7w6KAwU5NfwG78tNo9VsVlk7IPQj1a+DMvxSdtwj2BTmC618soDxpJyicI2r64XIs5EpGMsrmo+8txG+PxjWWJma1xe8FO//w1W+Yf1FY5vRJRhJc+Jxvos6XTTP3YOS1o2AbRb2rNNZaL5+W5Rajb0Q4QRYYA1q2QW8shyqbNAGuqiAzAPmW1FiMvm42fc+eQK/fHtZt6mNogoG/DOfxwWR2G07pkgl1/fQfR0nA90BM3VynU/+saENo+U4mqNsP8SEm9Jdu0FqLuteV7tSMLc7mgJ/PsoI52YfWtKpxc6ecaOWM8P7ZXHLsPcFa1QGkyTnCrB+8bCvCh1zLVXSfer6RyoTri/WvkAs1K14LRUXL+Oi8CEMBZ+N1UK6g7ayGKBzjJ+xSub5HULWXsrJu/grNQygEVWliY7CXZ9890syXvbQfe3b+ED53ALomCdj+FOW9O8tUJ8gqDvaeElqvhSLa1KMZ9iAhd1QDyz3ZCLyKdn812id/A8U2+bfxKYIYBTpwY4HOzKT8xwLfeaiDRWGs6R2UDtavRfuAu/LTGSzyTYLAghYfoKo9ngFwGACVHqTx/HCPNDj5q6cnYqPTsUdFTmaqZhSGf8vh28WFiGvX026HSro+orp0z5h5BMB5fuBJEHz/RlZrIlNqoARe7BOHUs2PEuCaA1DdT0fGlrNtsOV/vJRxrlzEtOsH5upinX8kKw FxGr7Yfo f7tsVTfndcKRfpy6UPHBL49y2ve/tNq2wAwKN8AkwiMp1lVie8lezRQNhZ/JrsrMpxPCBB7FFoWaaYTxhV+8FYbYWnhLqL61oB9pl9hu+utGBXM1r5vKZcaS64hv8hkQZUAGEV7yoV2Qa+Y40q0ZfmKYqLzqmGrx1Ll/GNJAxM0iTiW3u4VsTVWKvW63EsL3nsIPDA9EPuACT8IbugEEoK3oOB2eq0MbBMcyjqy+b7zP17Cpv39Ol5y6yogjVLVXFd0c8W0v0rbOL+Z5h47NQwSmpg4X4jm0s/EBxsfO5D8Qz3Wo= 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, 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.