Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2760724lqo; Mon, 20 May 2024 16:27:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVfA7MoVlv6msd8kRCdkvJuncKyJXWYSd/24631ifT/UYTkwX354AjmZi1qZ0H5L1uz68FG2Jb/RF4/+BkkgUzb9C+JPaIbNEKASE4eFw== X-Google-Smtp-Source: AGHT+IF0rtl2lBV3KqF74UQ7pntdiGDmN9crxU0fL2V2BI0WyI0I3qTB9tshyB4fY+1X7xVUPbm4 X-Received: by 2002:a50:d6d7:0:b0:574:eb6b:f50c with SMTP id 4fb4d7f45d1cf-57570ee2448mr6627676a12.6.1716247646052; Mon, 20 May 2024 16:27:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716247646; cv=pass; d=google.com; s=arc-20160816; b=eiblPM8QySVA04nmjSV5nJK66v788TOCYVW/yn/+evCQLM34ZzeBS5LPakUGAS+7bJ dHL4JN3hoJ9+LAzznOGke3WCX5+1zzeoM2rSO8noaySWh8X+vL89Hqg+58sU6h3shD0H FdB7zpVW5CMGasvEdSvYCPUB8CI7rxeqC8kBxvaI56BF+cWR8fWbBFISZ8YyxckcU4rj Q+JzYSHwg3uAL4731SZRAxz0b9EweBL3KuHiRQCIdme8/P67nk42RFtBrsbE6SPoBjWr 48P3vvMQD8LVmXurwLT+C39F/vIyEcJmiM4JopCsFrQp/1XU1kKRqNbga5amEatwptw9 IQzA== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=IeLkwEBul/z5hvAYOR5ch/FucXPvNElvTMYwlJONjiY=; fh=jAXtGm9a36NlNpNONVpx3dOn7bwd/RjDtQQat4D0Oc0=; b=Eyv04QOkSFqPcf6YXaBgl0gOeyB9x++mckRYUGKJKH05flscUmXMFxh/YVpCf2lMQF bgP4EwLeJweHpb6HlRvbJTKRU6eUpELYmEP2L2rWcsmkF+rlhAhFuQSxRBzzxIB85ItZ kx/a0DxKJFiwJyU4D+JN91gj4In/F1DsjYKPoTNPhlaRbmgSuRgh0OA9OPyDZPnzONOT 41w7qdMSuCMBbQbmnmzOHbDi9khUOnZdV0si8ejm2q7KWYtnKlovRAOPRZ6YWluYtI5Z Cj8KgcgepdFnCETOQIqFZ1boYZ4rQ8S59Vs+X4hx0SkKEOqHWkpMCOQUdRUvXpx5qndI Fwbw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Jkk4oy/N"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-184293-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184293-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733c2d5319si13664022a12.216.2024.05.20.16.27.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 16:27:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184293-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Jkk4oy/N"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-184293-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184293-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8A3B41F22CA4 for ; Mon, 20 May 2024 23:21:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B40FD4CE04; Mon, 20 May 2024 23:20:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Jkk4oy/N" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 7AD873D3BC for ; Mon, 20 May 2024 23:20:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716247253; cv=none; b=b+ZJiTTsCro++tkrGgVYxAEY28cPbsWyzDyXgSDj5e92l+cM1yMDHk/URrYN0I/t5CnQ3GC3KdPHq8V8HZPen9h+l7y2/bIiUK9iEzKr3IIG2MTr4Dclwx0/4/s+S8d8dKUHHwrA71Db0L3h9lJ3V987iO1tCY5+xCWK8va0G1s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716247253; c=relaxed/simple; bh=Da/CBR16or4UGo0B9Fv7lCV3lekLur2+eQ/p/ipcOog=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-type; b=KVYpCLjf/kk4SddYhpnMhXc23p+q/PLuPn01iGo4Ww3Ia/zyVcKQeaBEtEaZEI0xNRIlY4U3pZ4R5SrTcDHEOnJxJKdKGTspnuvhwUdsFbEnsl8s1id1VXNo9bhVMoM7AD6gjOneh5HmCLZ2iP3/D+xXQgnTHFZq6nq5z4DRMLM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Jkk4oy/N; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716247250; 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=Jkk4oy/NrMWPG9+kT1+obEjTwP9A9ORwZAyEvosIL1cckCgz+VtbCHBolR5nnnxRr2whwo drU6zNClyyo83qObf4ppfs35lBi3b39Wqj6hAoK04bnfa7nsVE5hAqJtTjxux8FJ5TIa83 H0oxF5FSTKuUqwgkki0GbH0Q4LwXH14= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-35-hoz3_hr3NuiVDhQ86QM5Bg-1; Mon, 20 May 2024 19:20:48 -0400 X-MC-Unique: hoz3_hr3NuiVDhQ86QM5Bg-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-792bd1dc658so2272253585a.1 for ; Mon, 20 May 2024 16:20:48 -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=WuO6C9X0NcYThNhyCzK9aUvdhWwRGgFN86TfzscM+nZdwnBTz+9b3scWbs2NsWWz2m D3tWp4yhW66ccq/DEmWE35GF0qJtaYqiCqOriYqpztx4aludso7Th7UDQryVQjdRCb2o iR45I5TpogcUcts0b4BUcTNIag1NQLj8ZFJmH7p48bNSxsU/nCn8tAL1IzmTcwBSjb0h sjQ3c6B5ShKmFsg1nIGpykC4UcbnTZ4DeYkTzbX6lgNI4X941/jGiHiGbeEOFW79gdwN iyCUL1eajNLMbf5m8v/J9U4LM77FPt9fbmuwZa5jyHIilmqtA0SvHPYFhIts9494jHL0 gMZg== X-Forwarded-Encrypted: i=1; AJvYcCWMKtZ9A4dp2xoQQiqZ61STuBk8wuyNB33ljG8+MGBOvj1l0kjdbvkIm3nF2V9kZx1KzyJKZ0sL786gUlOb2he5qXi2GTTlsOLy2aMF X-Gm-Message-State: AOJu0Yx4k8YbhqZt8hSqq5kXU8w52eTceksCBelHLXlpftg3K7RPCCZA rM2Q8CWlWtJYOEhLTqY8iWO9y59ECj/idCsOqnyo8wUbbI4uLhXZsRPrcM4lVHbd+Id1jRG5Fzt lQqZMKBT7FGacpB7FRrnEWY5nQOmiRemYUxOKtl6auMZOjjt9v1yoKRDI6DL4tG4VV2Q6Kg== X-Received: by 2002:a05:620a:378a:b0:790:9e84:9b75 with SMTP id af79cd13be357-79470ee35b9mr1220333685a.12.1716247247095; Mon, 20 May 2024 16:20:47 -0700 (PDT) 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit 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 --- 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); -- 2.44.0