From nobody Fri Dec 19 13:09:43 2025 Received: from PH0PR06CU001.outbound.protection.outlook.com (mail-westus3azon11011050.outbound.protection.outlook.com [40.107.208.50]) (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 50B5D32ABF3 for ; Mon, 8 Dec 2025 09:34:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.208.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765186478; cv=fail; b=Hli3hUw/34dIOUgfE9SjWnOVQH+Bw9qew50NfE1nAi7PV6KGj+bxeBv61/EAnukjCXaTaQ1vzNGjc0jrfxikcwRICvKxxsApXXaX0CPgqbxYqyHGubdON6DtpykzUEZg2TW794uw39GxO0OdAJ+4nvYTT+MqoCZFe72kdCuxnyQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765186478; c=relaxed/simple; bh=nzcSVlAzwQJsWFL9kY+GtRr2qxlNp0Ii/ubxRUNKH5Y=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VOuxs4FW2ZBkTqJyALCpL0PhPdGYmAqPYULVgjWxi7+TSKkzHnigDaPHVOGr0YmfWadrbFCjom5ozjZU6vKj0PbvHTNjTDzQ8U4+snBPlfK7lXHYfqnV7Uu3vYHtYvmxdBrWYEX2//lje9zzQYSjGPSkJIqsLxdbuMGPpdH4NfU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=pqTnIGjD; arc=fail smtp.client-ip=40.107.208.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="pqTnIGjD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IIP+2rCJf5HxnyTAzIeRPncQuKkBRqIjsvqz+/LK6vmwMcof/F/U3ti/vMuB9W0FxOwSd3lk9IVcuCDZGy7p87ytGu47no6eUcHqdWOaIZka5baGVh1mMclzIZ9WGvgMR9ehdl9pM2zDrzVi5DyN2eaHCGucL7eG+K8e9vIsFa7T1ux9q+BLpj9qBDzWktwAw37iG+hqEIp6MgAxzNFxFfjfJAfN/9xIcfc4TBVSJ+zUWXE81JhvI/G0q07xfYuH7nWnju56aHmZp3SF6uCNrBXts6CS4VitNjLY2ooykFXgal2OlW9BWGfZ+lAZ3nukdSU2fIV0HBzOupleqVHOIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dcRttznnPlmNFxWamyXp78LWnXIwoUYwKGU179U/UQg=; b=NIvkbfZN9IilnxR6lXAojStF0SOUGLcpqO8ZNwXXzXEpmNl+sZpd35J61o5xLksU4QpFD5hIF+FFsgtS8jFuRH/TISWpkW2jiLPRTGdHzjDv3dQSPOGRuJSaL1B9Cm0+cQgD6TOjtusb49ulNedhHTUvReAHz9BqqfDZQpPVqtjGYc9vbqZaGWgaueVv8DA2Eoa26fHXiZWgfTmgtsNgpN8YHS2QMvpitLpKDFkQeQwk8F8ny5dDojYROaKs7f8TuHeaYGCpHRqylo0gAUS7AgGxT33K5iPalIXAR1214729tbaBVE5XZPuK4FgfnkZdQDJ6ad2HFzQHnwhfRjTpig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dcRttznnPlmNFxWamyXp78LWnXIwoUYwKGU179U/UQg=; b=pqTnIGjD4EeLYL/2rN8Pyt4WEJWKLkjbr2KG+SqMNf0rxF4ZM7JHx5QgMOHKoqwkS22RJx75ACjSE8WMxru2Qkz39lYi5DZ7YxId8yYoMgBYbKQu8ShAPvM9p8vb/2iRWMPepkR8rYU6zdLDu3hkJ56qDn1ktFIJ0i/q/DcHEjw= Received: from DM6PR01CA0012.prod.exchangelabs.com (2603:10b6:5:296::17) by IA0PR12MB7697.namprd12.prod.outlook.com (2603:10b6:208:433::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9388.14; Mon, 8 Dec 2025 09:34:30 +0000 Received: from DS3PEPF0000C37F.namprd04.prod.outlook.com (2603:10b6:5:296:cafe::f8) by DM6PR01CA0012.outlook.office365.com (2603:10b6:5:296::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9388.14 via Frontend Transport; Mon, 8 Dec 2025 09:34:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by DS3PEPF0000C37F.mail.protection.outlook.com (10.167.23.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Mon, 8 Dec 2025 09:34:30 +0000 Received: from BLRKPRNAYAK.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Mon, 8 Dec 2025 03:34:24 -0600 From: K Prateek Nayak To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner CC: , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak , "Gautham R. Shenoy" , Swapnil Sapkal , Shrikanth Hegde , Chen Yu Subject: [RESEND RFC PATCH v2 23/29] sched/fair: Remove "nohz.idle_cpus_mask" Date: Mon, 8 Dec 2025 09:27:09 +0000 Message-ID: <20251208092744.32737-23-kprateek.nayak@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251208083602.31898-1-kprateek.nayak@amd.com> References: <20251208083602.31898-1-kprateek.nayak@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37F:EE_|IA0PR12MB7697:EE_ X-MS-Office365-Filtering-Correlation-Id: cf4e6c6c-8a10-45f7-f034-08de363cfd24 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700013|376014|7416014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?6mHo3fQP16wimCXdUxccHz56TptuhEESQ8NsutfPljwPgT4iZ+9m2JJiwptP?= =?us-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fBbHy0NdUdRtYkl3M+47b/KtFrrnc?= =?us-ascii?Q?inrnwsaDNSNBSpKAXwJbc9aUdS1Z/5Scempmkc0iPTh7rjExkY9TO7zhsm+7?= =?us-ascii?Q?Gs3lVuNAbSbyHKaulR6R6nHWrlX0jNeCqqTG8MUo7QacazVu4UKeIG5Zk7CG?= =?us-ascii?Q?KVpnwJhzgJKSUFWcDz6C0/reaGjElnMxnA9VPbPV73cc5dS5W9qpm9FECuVP?= =?us-ascii?Q?cecYwfzDyn3k27PiS31jheKWnKXtDhqSs/6Jj93K5VoslhxldoYPMwYqN0OE?= =?us-ascii?Q?qVwHIkFITYXgbuSBTiTrOBHJGRnMEBt6Vjit2MxZ/VaMcMUI8QupCDH9/ptv?= =?us-ascii?Q?k7nIV/DURjnf0ZjLpjXd4Wrk9RfxUyptWFymxKIr5QT68XwcBki612h4bz59?= =?us-ascii?Q?XzwOdMWQhcu38s3VgVoLqNU68bI+rbXTj5/TLXu+HTc0uwFfGgpBJAMms9Wp?= =?us-ascii?Q?eMa7aznTqYMlvFIMCYglAfWt/IM1hbGWYFKwnwZFHOTidxvNtz26DRxwMftr?= =?us-ascii?Q?KB+oO8lmrbI3EM0jcGZSzmHO3Bl40cuLPiJuWDitKcT7tJYXFLdn30VVb328?= =?us-ascii?Q?aqnz0AfPmt8V38XiUeHjfS571s7lDz+pq1eDIy0pL1rnB2/xHA30QXTUchG5?= =?us-ascii?Q?qsE1tu+0PrLdBx/tpu0=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(36860700013)(376014)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2025 09:34:30.5379 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf4e6c6c-8a10-45f7-f034-08de363cfd24 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C37F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7697 Content-Type: text/plain; charset="utf-8" All users of "nohz.idle_cpus_mask" have been converted to use the distributed nohz idle tracking using "nohz_shared_list". Get rid of the centralized "nohz.idle_cpus_mask" based tracking. Signed-off-by: K Prateek Nayak --- kernel/sched/fair.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index b17861bd684f..46cb88e88b31 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7143,7 +7143,6 @@ static DEFINE_PER_CPU(cpumask_var_t, should_we_balanc= e_tmpmask); #ifdef CONFIG_NO_HZ_COMMON =20 static struct { - cpumask_var_t idle_cpus_mask; atomic_t nr_cpus; int has_blocked; /* Idle CPUS has blocked load */ int needs_update; /* Newly idle CPUs need their next_balance collated */ @@ -12621,7 +12620,6 @@ void nohz_balance_exit_idle(struct rq *rq) return; =20 WRITE_ONCE(rq->nohz_tick_stopped, 0); - cpumask_clear_cpu(rq->cpu, nohz.idle_cpus_mask); atomic_dec(&nohz.nr_cpus); =20 set_cpu_sd_state_busy(rq->cpu); @@ -12680,8 +12678,9 @@ void nohz_balance_enter_idle(int cpu) /* * The tick is still stopped but load could have been added in the * meantime. We set the nohz.has_blocked flag to trig a check of the - * *_avg. The CPU is already part of nohz.idle_cpus_mask so the clear - * of nohz.has_blocked can only happen after checking the new load + * *_avg. The CPU is already part of sd_nohz->idle_cpus_mask so the + * clear of nohz.has_blocked can only happen after checking the new + * load */ if (READ_ONCE(rq->nohz_tick_stopped)) goto out; @@ -12692,7 +12691,6 @@ void nohz_balance_enter_idle(int cpu) =20 WRITE_ONCE(rq->nohz_tick_stopped, 1); =20 - cpumask_set_cpu(cpu, nohz.idle_cpus_mask); atomic_inc(&nohz.nr_cpus); =20 set_cpu_sd_state_idle(cpu); @@ -12936,15 +12934,16 @@ static bool nohz_idle_balance(struct rq *this_rq,= enum cpu_idle_type idle) * entering idle state. Here we run ILB directly without issuing IPIs. * * Note that when this function is called, the tick may not yet be stopped= on - * this CPU yet. nohz.idle_cpus_mask is updated only when tick is stopped = and - * cleared on the next busy tick. In other words, nohz.idle_cpus_mask upda= tes - * don't align with CPUs enter/exit idle to avoid bottlenecks due to high = idle - * entry/exit rate (usec). So it is possible that _nohz_idle_balance() is - * called from this function on (this) CPU that's not yet in the mask. Tha= t's - * OK because the goal of nohz_run_idle_balance() is to run ILB only for - * updating the blocked load of already idle CPUs without waking up one of - * those idle CPUs and outside the preempt disable / IRQ off phase of the = local - * cpu about to enter idle, because it can take a long time. + * this CPU yet. sd_nohz->nohz_idle_cpus_mask is updated only when tick is + * stopped and cleared on the next busy tick. In other words, + * sd_nohz->nohz_idle_cpus_mask updates don't align with CPUs enter/exit i= dle + * to avoid bottlenecks due to high idle entry/exit rate (usec). So it is + * possible that _nohz_idle_balance() is called from this function on (thi= s) + * CPU that's not yet in the mask. That's OK because the goal of + * nohz_run_idle_balance() is to run ILB only for updating the blocked loa= d of + * already idle CPUs without waking up one of those idle CPUs and outside = the + * preempt disable / IRQ off phase of the local cpu about to enter idle, + * because it can take a long time. */ void nohz_run_idle_balance(int cpu) { @@ -14138,6 +14137,5 @@ __init void init_sched_fair_class(void) #ifdef CONFIG_NO_HZ_COMMON nohz.next_balance =3D jiffies; nohz.next_blocked =3D jiffies; - zalloc_cpumask_var(&nohz.idle_cpus_mask, GFP_NOWAIT); #endif } --=20 2.43.0