From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from DM1PR04CU001.outbound.protection.outlook.com (mail-centralusazon11010010.outbound.protection.outlook.com [52.101.61.10]) (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 5544834FF45 for ; Tue, 4 Aug 2026 09:49:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.61.10 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785836941; cv=fail; b=Fnr9lp0TqoGEtTVUl0UcVrT+J3uTOsJEWwqc6Xc6WHzhRNUnnONYydIex6m0HlIK+F3aRj3yu2TcGx3aCLNRHvr7IiEx5Hk/LRa9iZ8tr/+oxOvL58+Gg+fyrNN5MHP+fUANnqRayfulPEq2dnAN58L6Jb+175bnA3FkwuHe6YM= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785836941; c=relaxed/simple; bh=5w7E5NWErVDEVxy7ADflqDT2eZdH7gUrtq0kRxi21MU=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=qnDjowSGWujLkWWTJKvu7F7UP1apDDCKAyrl+V9gDxWlbSN59pR83yVpt1mb6p4xG+XyK4mmHRhFe3+SGcJ+FTD8X59QC4JHCvMrCq1M/XZ4e6bVOJKJtSQsXJvDa7oGOd+xXHRTRXiqlvlnf6TxtpG1foCa8HOoaJpgKOURhF4= 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=RlUmYN6z; arc=fail smtp.client-ip=52.101.61.10 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="RlUmYN6z" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eC+oxEz2RJTfbsONVp41lFvZXOF/blyKZAMqVnbqQDcopQSzV0JXcomFITAEFEvTqO73rP41H9yOdVtmHRkOrfu2bZZoCniI0Uq0ryzQ1ZxUUtnz8b9UJFm2hWbvAI7LyIIgYYq0jYMA/dHVe8uoKLQv/j2YiPQWn03asloyKfhQLTpg/EjwItKYHarPm6OxXlrf1CQSYsD/vOB/vklKwIEfKyGQTkjOGSgyoRMSu5e/Qk7yccdMPjPg/qbMMAd/TVEM/It3DgMyi0QkdoO8g9bKI9lJazpBD64kzabnYMgyDZsbFTeBpLFFm1Z+sHBbj1wI5SJB7iXAznz9sdZ3Lg== 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=z3QN7WQ2ZsFc/8wYlULS9yaxCqelmRXQ9w+OUXLQLPA=; b=Srp1vBxmtKC4IoQTnWg65LYutn8VsZWvCbEpTVjy7GsTpEHOMhJH0wYQfL2k+MvBIgHv+SHefmbIZhO316yO2fVB+3rGsAnTXv+PIUBE0XmF8InBVwOMFCZKgqdoaT5m7xNNExjtjaQ8FVnII9fnIKyhBkkrRZyJvtFsKLz9XfMADug9hr3kYc4JJgwsq8uUqVjlMab38e8Wo3a+9+AYGJ77AT5nv9+iQfUfE+XFgupamp2O80yCMKjA8Kkrngb0FiSjlV8MrQERYB8dJ534d+fesUDaMM3YMHPsS8D8tg9HoOEsI2GotwGm8N0X2P+qAYECNPmQqrK3n04ENy8CnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linaro.org 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=z3QN7WQ2ZsFc/8wYlULS9yaxCqelmRXQ9w+OUXLQLPA=; b=RlUmYN6z3rIFLduM/q+y8hIaB9YG+nu6PahaTNgdYvRt1uIp8174Z7hYPtwTPbc+xNB0kDzqPUimq1bUQ/t6x8J5rigTBq8IsT/FpqpwfFSFH6ysDu+Lr/hGfB/X7RRWEVhbhhzMQ31cezbU3GxOr+gGqeEekGl6c3B5W/ORmus= Received: from BN9PR03CA0876.namprd03.prod.outlook.com (2603:10b6:408:13c::11) by SN7PR12MB7980.namprd12.prod.outlook.com (2603:10b6:806:341::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.292.15; Tue, 4 Aug 2026 09:48:54 +0000 Received: from BN2PEPF000055DF.namprd21.prod.outlook.com (2603:10b6:408:13c:cafe::29) by BN9PR03CA0876.outlook.office365.com (2603:10b6:408:13c::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.292.15 via Frontend Transport; Tue, 4 Aug 2026 09:48:54 +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 BN2PEPF000055DF.mail.protection.outlook.com (10.167.245.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.315.0 via Frontend Transport; Tue, 4 Aug 2026 09:48:53 +0000 Received: from satlexmb10.amd.com (10.181.42.219) 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.41; Tue, 4 Aug 2026 04:48:53 -0500 Received: from satlexmb08.amd.com (10.181.42.217) by satlexmb10.amd.com (10.181.42.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Tue, 4 Aug 2026 04:48:52 -0500 Received: from [10.136.47.95] (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.41 via Frontend Transport; Tue, 4 Aug 2026 04:48:48 -0500 Message-ID: Date: Tue, 4 Aug 2026 15:18:42 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] sched/fair: Prefer fully idle cores for NOHZ balancing To: Vincent Guittot , Andrea Righi CC: Ingo Molnar , Peter Zijlstra , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Christian Loehle , "Shrikanth Hegde" , Phil Auld , Mete Durlu , References: <20260731191957.3199642-1-arighi@nvidia.com> Content-Language: en-US From: K Prateek Nayak In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000055DF:EE_|SN7PR12MB7980:EE_ X-MS-Office365-Filtering-Correlation-Id: c430e3a1-a9a8-4bd1-9ce7-08def20d9814 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700016|7416014|1800799024|376014|23010399003|11063799006|4143699003|56012099006|18002099003|22082099003|10067099003; X-Microsoft-Antispam-Message-Info: 4BFlprhrFrSM7x6JgBIyzZ9KAHIv7nkUuUARCCF61wJvzIzFOCpj1Ja7F/1aQtcVBg0lbi9FnEj2SUzW45uRfjNiLW7XYd7kxVMI4lhUzaV34sNSRkg8rJoK1qfC58XgXT5KJAj1RbOlX2DFIpNwvfW7JozP75nuxTkk3/gJXmeW4+qZYSc8a0hRI7tUDEh3++XMixGI8bfDwZnXSxTzLhL8ldMGYgaiSDV5azG6yU/EtRpqpnawkvaAp87c2Ordepqo11TU618Ia9roOQDfbTYhf+1AJDEp8tAUd2Jgd651d0oRbTRobZJ4dxRpHUlwj0Xa9eD884LsVK4u9os0j7BjJ25FGDe6QzdSh+jGEti85ojf+CJsSYYLBH/IAUBxpMWR1WLug/BdAmLXG3NDGc2mranDNu4Cpw5zahkQfFMTgczpHzhiUK7ldSGd8eT2uNeY8OH5r+dsFLHnu0Z/9GVvEr8HnufRn5Vqy0JLF/SzZNZD1invSWf+wB3eIoCCdtWjpurqU05rEhDw8n+Kr+KrF9hCwP22OrUeTRCQAdGxlVDnn/poL8drLbeIZ+fTUMb6kD9i1GZZRnYyFew3WOidpnUkOWvORCzgMcP7tebQ3JnqyXCzkm+F1BYBMaZdGiW97ZQLFe+PnIszQHBzKaPycPc0HaMBpdCDITmbTnIf8xTdP05GYcmWPwUzk2PGL9LXdURZYwTs1PXcqZK+NQ== 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)(36860700016)(7416014)(1800799024)(376014)(23010399003)(11063799006)(4143699003)(56012099006)(18002099003)(22082099003)(10067099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ztOl3KPFmf5OvAKDT2VBTk2Q6hwUJ/MI4vylhYXI32lcQHxhXCqVWTxLT1JgOH922f7/s+jSRshn6FvLUAHg/HpE3j7rUCEaZL1otMhzrgy60XuelLP8JRiX7JQQYPugQ/Xv4In7Zmd6TX123w6+mTNW1O9bvk8Rs1bRp201ToNl7TtxwPpmipbx3bIZN0CpYZqph1a1VaKB8HF3w5A9Dv7I3iwBPtKB6YK4ZBZGh0qM4UygURafeYdKPhMav9m0oILmc0SWydkjd41ggj8PWFaLAxye1wyGuH34J0SqioYGM+KuOFg2wykuzpOh+2bNBtTGZNLvDn33hpft439znHL0whhYHHCuIbbSiRTFmKNQxZ2zytfDtilO/4wYEfnj1yls5zlDDrpia14gF01bkJh2SuyddbSsPp6jwjDkQS8DHR959GU1q3C9kwBsBtTW X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2026 09:48:53.2748 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c430e3a1-a9a8-4bd1-9ce7-08def20d9814 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: BN2PEPF000055DF.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7980 Hello Vincent, On 8/4/2026 2:12 PM, Vincent Guittot wrote: >> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >> index 37001c63452e5..574b6b3ee922a 100644 >> --- a/kernel/sched/fair.c >> +++ b/kernel/sched/fair.c >> @@ -13965,28 +13965,66 @@ static inline int on_null_domain(struct rq *rq) >> static inline int find_new_ilb(void) >> { >> int this_cpu = smp_processor_id(); >> - const struct cpumask *hk_mask; >> - int ilb_cpu; >> + struct cpumask *ilb_cpus; >> + int ilb_cpu, fallback = -1; >> + >> + lockdep_assert_irqs_disabled(); >> >> - hk_mask = housekeeping_cpumask(HK_TYPE_KERNEL_NOISE); >> + /* >> + * Reuse the per-CPU select_rq_mask, which is protected from concurrent >> + * use on this CPU by having interrupts disabled. >> + */ >> + ilb_cpus = this_cpu_cpumask_var_ptr(select_rq_mask); >> + cpumask_and(ilb_cpus, nohz.idle_cpus_mask, >> + housekeeping_cpumask(HK_TYPE_KERNEL_NOISE)); >> >> - for_each_cpu_and(ilb_cpu, nohz.idle_cpus_mask, hk_mask) { >> + for_each_cpu(ilb_cpu, ilb_cpus) { >> if (ilb_cpu == this_cpu) > > this_cpu is not idle so you can apply the same as below Dumb question: nohz_balancer_kick() already does a nohz_balance_exit_idle(rq) before trying to find the ilb_cpu via find_new_ilb() so is it even possible for this_cpu to be set on the nohz.idle_cpus_mask here? Even on weakly ordered systems, reads and writes to the same location (nohz.idle_cpus_mask) cannot get reordered right? > > Other than that looks good to me > >> continue; >> >> - if (idle_cpu(ilb_cpu)) >> - return ilb_cpu; >> + if (!idle_cpu(ilb_cpu)) { > > + if (ilb_cpu == this_cpu || !idle_cpu(ilb_cpu)) { Otherwise, this makes sense. -- Thanks and Regards, Prateek