From patchwork Mon May 20 23:15:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Chanudet X-Patchwork-Id: 13668721 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5DC30C25B77 for ; Mon, 20 May 2024 23:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=TrdIZQOZXcF2IslhLSZIdJRLF+vZJb0zqz5VE0S+yoU=; b=FISjq7DrXwfpHx efO4EAi8tlMsRP0hVBU508LEeD9JmPZvMmQo9/OjEwuVZhxsqcXZRKPE2to1yVffR0pp3XZ9qHmMI MYyWU9njS0KtCGMVo6A+fAt1mvKbi1AHOKUrH5ekHJUMjIkUxmEZDvYcLJ3D8JVRXlEk+gTcCS9UB qyVfK0orxZDLur18UmivbXYE+td4S26L5ZrdIcbJhuU5W7zZ1EpPBcr4JcA2hN3xJsZGxXTB0Fxez wz2Nvsj6L5UCUOBuybQLS4u3lDaED387f6IQNzTW8wWFb6FoXBB1PXdrCaqYpUM5Tuw+bUa5jxh9+ Xj0y7A3b0Eh843SPnJHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9CLY-0000000Fn2u-1C2e; Mon, 20 May 2024 23:23:12 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9CLU-0000000Fn0a-28nE for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2024 23:23:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716247381; h=from:from: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; bh=IeLkwEBul/z5hvAYOR5ch/FucXPvNElvTMYwlJONjiY=; b=S73Y5k+QVNqScdmE0BA0Qbak6nRMbIrZwqDR2HWbFPTMtac0yw5tts+/6YwtHU6ptf5xDx GMMCANr5yPrEomv4mLlxtQapWXFpr9qMTu35Rfmu/sKcgcgmU8j8G11Cmf6r+rWiwBwSCs QZXSMa8mSG/hfznfmYT8JKcCG+Zexw8= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-33-PiofgJ6dNUWJWdwxvtCWXA-1; Mon, 20 May 2024 19:20:47 -0400 X-MC-Unique: PiofgJ6dNUWJWdwxvtCWXA-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-792bd1dc658so2272253185a.1 for ; Mon, 20 May 2024 16:20:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716247247; x=1716852047; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IeLkwEBul/z5hvAYOR5ch/FucXPvNElvTMYwlJONjiY=; b=nCK7NtMmoxbct4w2BdKBdgZdXkdUK377agXjP+Wo5R5DXk7A/DSMnJpUg3Tq8ZxX7u 0xoB/0ZaTgMp7ToP4XfBmZExl+ksXbOcfmzCFhevjvqL+4Nt8GoBCPI3ok0ZM45sShkF EsGZ3WQJreoO612+pcNEnuzbW5gxQZaJG1TGW414sDwQ+r0yP1vV+LamaaJKPnQtqbNm 0vB8y2jjiK+dqy0Lm14u3lkKVzSu6AChxrq9Jwwf1HjOZvDcNsWz7n6qZqOkY5n2mvoL RbTfY0PBfcA2vM4Cxy5iSbRnS8GoF/HNAPVcfnJWF0RfTzqwTouMhP9nzCQPELEGhTLU SQwA== X-Forwarded-Encrypted: i=1; AJvYcCXsX+KTN8Ks+5hmw91SLHOyUETljLRHq+uNSIpNKVD32/skS7/1qlsa6rDN9BgpgPks/tGmtDPyLOusuPvcsuVOi6OQUljTY7YsPCQB9iZ/QsnA7tg= X-Gm-Message-State: AOJu0YwbfmE6QwxhS6s2bLcU5FS2oEwuZ4JrPVhBB6x+BZFxfgBmzMiQ Ntf1tMnGtAd/6dpTkI2BKkRmPeX6P5BxsAQzGVpC+IamfmnouUFPf7x1H5tpvjVQWkDX/JAyyz7 S0h1g1k1HeZIlwYg9SZSL/jXfN9/ikMClfvRGOE3kKw97DNq2BnxI3lh9tN5HtP6iB3g6J9PG X-Received: by 2002:a05:620a:378a:b0:790:9e84:9b75 with SMTP id af79cd13be357-79470ee35b9mr1220334185a.12.1716247247114; Mon, 20 May 2024 16:20:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEWpismoPVZlLN0ErtG17dDj9o0/D4AFXwHCL0aHduFKzUmTiJonT5jwHLii4qs5WVn6WTX9A== X-Received: by 2002:a05:620a:378a:b0:790:9e84:9b75 with SMTP id af79cd13be357-79470ee35b9mr1220330485a.12.1716247246505; Mon, 20 May 2024 16:20:46 -0700 (PDT) Received: from localhost (pool-71-184-142-128.bstnma.fios.verizon.net. [71.184.142.128]) by smtp.gmail.com with ESMTPSA id af79cd13be357-792bf2fc3dbsm1232517385a.96.2024.05.20.16.20.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 16:20:46 -0700 (PDT) From: Eric Chanudet To: Catalin Marinas , Will Deacon , Baoquan He , Andrew Morton , Zhen Lei , Yajun Deng , "Mike Rapoport (IBM)" , Zhang Jianhua , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Eric Chanudet Subject: [PATCH] arm64: init: override deferred_page_init_max_threads Date: Mon, 20 May 2024 19:15:59 -0400 Message-ID: <20240520231555.395979-5-echanude@redhat.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240520_162308_629189_29C99255 X-CRM114-Status: GOOD ( 10.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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%) | Signed-off-by: Eric Chanudet Reviewed-by: Baoquan He --- arch/arm64/mm/init.c | 7 +++++++ 1 file changed, 7 insertions(+) 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 + int pfn_is_map_memory(unsigned long pfn) { phys_addr_t addr = PFN_PHYS(pfn);