From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from CY7PR03CU001.outbound.protection.outlook.com (mail-westcentralusazon11010069.outbound.protection.outlook.com [40.93.198.69]) (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 CE59D3B19A5 for ; Thu, 4 Jun 2026 06:09:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.198.69 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780553395; cv=fail; b=hov1KhgCD09z29CiEdqDV60Ca5bKscjmFGD/qJ8WKlo3chjPtdb/yM0NwSA0t+P0Lxwr7gre5Ddb1GmLA/z7/pDWYjsu/qIsdIDt3ziaSxiXf3iZg8VFzOjYSKokdCA0Hbkzd6jRRYjFTKwBKRCFbDPuMDP3Rgb1z2+h8tMRALs= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780553395; c=relaxed/simple; bh=+/ecxSsXc15Xq9V6tQdbGEiZNduAkRzdnHV9aI751Ko=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=mWYTEoAdE+DIG47iBshTbktP+69ptNTv63H7YR/AmmIRADXWxcmhYMXslFrh+iV7VX+JhMBobKHZikUX9QCN77MGi7zXydDuv9K206Oskh0KGE35jOAmwvu/gt07f0h+cABk1911ciWH18cyLQhsEIMuPEdmT3D2fcCA8p7HlUo= 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=Xq7FQVeT; arc=fail smtp.client-ip=40.93.198.69 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="Xq7FQVeT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fNMixKjQgqnUtR9quiul4aFoCuFhFaDDREeYF9zJbvsml9aQSl1FNRvlZ6z7gbKLw+a+WrAxipGttxwu/yqaRm4twUM1eqz0e0sDEmOp5OYgmmk2JlhKdN6HLPHH0f2N9Cqpq0k3rINrn5lTZGfmecQvZqpwKvCis0LJHLVB9mrNZuLbDE0hzDiXvy7LlvJteyDFYmurVswig7CumtCAAdTkyFOq/wazSTRp95qyFtVyZ8IY7sl7lDD5vm2QXPiI9pFgLuHzSjQmLWqHLhZOycW/6ep0sLeZvyScONR5ZUJTdoWXjWiPFXYhg50ETfjw+xsPsvesnBO5dg006Tqb+g== 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=sn9hYeCaGlTQZIKhGrGdlZtIYCsqLDUaIvGILwAqXu0=; b=Vq/ysKXKKVNLKJlVxlvWf+cN26geDr8AVaQTah2jF1sLKkuRqe1laFsCay75uc4fnxIiTI0TuBSMTmmXCOBp0SFSZM0t/HMig+aGWhhNcRl+KM9sBne3nHiB3SjoOgAHeW9w0JTfz1yNgYDEM+5RaCm43CBupoVIjSICx9ZjTILW6oh8HpR9oqSv5rWC6tDFfHFLJUX/B6LV039eCC2sAcJ19MhBq7pzuYLBE51uxBP8dLU6FzX/H6I09dnYGvAtgUdhO1ihTPxi0YX+78AyOMi2Dv1nQtTq1PJLQc3phcCKlw1PXL8Hec+4cXtD1iqEC2NI0s0OOqP0xE6PBalycw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux.ibm.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=sn9hYeCaGlTQZIKhGrGdlZtIYCsqLDUaIvGILwAqXu0=; b=Xq7FQVeTwCDdZ7xv0y9Wv4dMOjFzpWUTqNtASXierfqX+j/NefOzHHIZusNmFtH7XOOUxK8BhTuN5qo582Vfwl5yDSWIHo/i4Lk4R7DBvDNlFiVraeptnuvtZJlLhjrf1nDTRRZXVCGX1/Z5q0HMEv0oBf0V4blt2P31gaIES1Y= Received: from CY5PR17CA0046.namprd17.prod.outlook.com (2603:10b6:930:12::11) by CH3PR12MB8728.namprd12.prod.outlook.com (2603:10b6:610:171::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.92.7; Thu, 4 Jun 2026 06:09:49 +0000 Received: from CH3PEPF00000018.namprd21.prod.outlook.com (2603:10b6:930:12:cafe::7d) by CY5PR17CA0046.outlook.office365.com (2603:10b6:930:12::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.92.7 via Frontend Transport; Thu, 4 Jun 2026 06:09:49 +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 CH3PEPF00000018.mail.protection.outlook.com (10.167.244.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.113.2 via Frontend Transport; Thu, 4 Jun 2026 06:09:49 +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; Thu, 4 Jun 2026 01:09:48 -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; Thu, 4 Jun 2026 01:09:47 -0500 Received: from [10.136.33.4] (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.41 via Frontend Transport; Thu, 4 Jun 2026 01:09:40 -0500 Message-ID: Date: Thu, 4 Jun 2026 11:39:39 +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 08/20] sched/fair: load balance only among preferred CPUs To: Shrikanth Hegde , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , References: <20260514152204.481115-1-sshegde@linux.ibm.com> <20260514152204.481115-9-sshegde@linux.ibm.com> <0aa0d84c-9d0e-4ca1-9a9c-6370976a0974@amd.com> <8281bd2a-31a1-4e18-aea2-830777a454a6@linux.ibm.com> Content-Language: en-US From: K Prateek Nayak In-Reply-To: <8281bd2a-31a1-4e18-aea2-830777a454a6@linux.ibm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000018:EE_|CH3PR12MB8728:EE_ X-MS-Office365-Filtering-Correlation-Id: b827a54b-f982-41c1-9bab-08dec1ffe274 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|7416014|1800799024|82310400026|376014|18002099003|6133799003|22082099003|56012099006|11063799006|5023799004|4143699003; X-Microsoft-Antispam-Message-Info: eIUEnEP3SFAFyzOP92Nucx6Z5pPDTCBO++CegT5k6pVG7ujqKtg++HaitEpRQyUzDFQZlT+FkSDa7GvkdzfG21s14pbfzUjMx1n6+m85GXrKIBCZe3dzrhe0IvP/IucV+ZJwVsdH35NfxWxk8K75GlmqCOp69vihYir7o4aYGKx4xLybPrDBX9BYxv8jxh5qzQ0QFysZL6XLKOqdxfZQXbfx0lFcLOpoqbsfdaDvEJhONPfNQVV5dDwo19xA68f3+fxuyp06GgLyecz/QDaSDYS4wI0oQlw8Z0mvDPKvs02UlbQ7o0icx7/Sh/p/xDcbTh8HFheELRLxNQJMo3hCfZ9eVmPFEv/4CIZrjphzpW9jfXN1cZ+9hfrS9+S/G6JTuUn2g35ae/919wtltfEeq9ckYA5Q71OZ7959TqtKLQYgA0jDDgEn3pUYwe33OSgnfFc8rso2MArPziaNERg6JjaW9ltLa4xrC5A4V2VtxrmS1iKn+btw82LreGqsJisqgoIckc5JX0fJQtAgd+eK/lOScJ7/YrvXTMezog3dXngmvnrANz4CUixMwptoM9xruUogDkjJOB5wwa2exokoGCxwB45aHxqzyeWqgS0es9aszSPdKXJyNyZr/DBteGlGhMyUci8lZVcZ2pJraYaoJOxI8AyfNuvZ2WFI/AN/a7zh+6aOTB49ugt2PV4nAeqQDurr0HuT5OYmmqdKBLPwBczj0tIzotLGfuKB3Z9LaTM= 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)(36860700016)(7416014)(1800799024)(82310400026)(376014)(18002099003)(6133799003)(22082099003)(56012099006)(11063799006)(5023799004)(4143699003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Cu7ss7rQG0ycVO1B0gZGzes+tf4r2Ki+kM1ngM5io2fhro3aswFWVWaLdJbJJxdCVM536ONeOrNHOBCewrNRnHI5E1+CMx7+arh/QeX7in02h0iwCqeou99QTglhixEIjVszrUbh39tH+Q4pDcGcr3I7Z2PtAOX9G3xTyHYCxnxVu6SoTj4EUcIXELRbX9/kITRba+OKKLuAB/waIn0Wl4nfgGu4UuFq7xY03k7z9DiuSdc5u3UBqXaCWzbAfVQFYbxwzX8znFAn8fqt9jP/NBl7/hTTPPzl55atx9OXGPLS9uQrIhMr3SGljwBDkmFXmo8CrAbDkX+xl1iNUzEIA6OymbqHr150r6+uPimKRnzXpJeuvx5x5DXnWtOmomqYMiaxM5edwOxzQcfQjoihaJPtK4LTdxY0bPuQ/A0v0BxYYqHHvoIlFBgYgtV4Euyh X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2026 06:09:49.2801 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b827a54b-f982-41c1-9bab-08dec1ffe274 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: CH3PEPF00000018.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8728 Hello Shrikanth, On 6/4/2026 11:15 AM, Shrikanth Hegde wrote: > Hi Prateek. > Thanks for reviewing the patchset and tags. > > On 6/4/26 10:50 AM, K Prateek Nayak wrote: >> Hello Shrikanth, >> >> On 5/14/2026 8:51 PM, Shrikanth Hegde wrote: >>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >>> index a704285ac55a..0a851d4b0d7e 100644 >>> --- a/kernel/sched/fair.c >>> +++ b/kernel/sched/fair.c >>> @@ -12087,6 +12087,9 @@ static int sched_balance_rq(int this_cpu, struct rq *this_rq, >>>         cpumask_and(cpus, sched_domain_span(sd), cpu_active_mask); >>>   +    /* Spread load among preferred CPUs */ >>> +    cpumask_and(cpus, cpus, cpu_preferred_mask); >> >> nit. >> >> Instead of the onine_mask, can we keep the cpu_preferred_mask closer in sync >> with the active_mask? > > I tried to make it active_mask. When there is high steal time, > a CPU marked as not-active isn't available for workload which pins > them. That would break user affinities. Ack! Sorry for the confusion. More details below ... > >> >> That way, if we can ensure that a preferred CPU is always a subset of the >> active_mask, we can save on a couple of cpumask_and() operations by just >> looking at preferred_mask instead of both the active_mask and the >> preferred_mask. >> > > active mask used heavily today. I didn't want to merge the two. I didn't suggest merging the two - simply clearing the CPU as preferred before it is transitioned out of the active mask ... > >> Are there any complications in that approach to track it via >> sched_cpu_activate() / sched_cpu_deactivate()? > > Sorry i didn;t get this part. You mean track preferred mask with it? ... just moving set_cpu_preferred() into sched_cpu_activate() and sched_cpu_deactivate() instead of doing it at set_cpu_online(). > > We end up calling sched domain rebuild too if we go via sched_cpu_activate >         build_sched_domains+8 >         partition_sched_domains_locked+1316 >         partition_sched_domains+80 >         rebuild_sched_domains_locked+332 >         cpuset_handle_hotplug+1456 >         sched_cpu_deactivate+608 >         cpuhp_invoke_callback+504 >         cpuhp_thread_fun+324 >         smpboot_thread_fn+556 > > >> > > What is active_mask guaranteed to provide today? Are there any ABI for it > or we are free to change it? I thin it is just a transition mask between the CPU being marked online -> active and inactive -> offline. Simply suggests the CPU is available for the scheduler to run tasks on it. -- Thanks and Regards, Prateek