From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from PH7PR06CU001.outbound.protection.outlook.com (mail-westus3azon11010001.outbound.protection.outlook.com [52.101.201.1]) (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 CABA72DE70B for ; Tue, 17 Feb 2026 08:10:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.201.1 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771315811; cv=fail; b=GRRwkHb6eylLNPA40ImchSJTPLAhHsJOhe/P13qg7DUCHfuCr1ef6lOr5kTdeMMtkqB1yQeBacRVfqZzgs5FWMT6e4pRAvwJTwP6TPCAynh+EGtX3XAM0GdXsXsaG1KuJ1EyrW+gKQ0CPqk8EI30qFTTrmtsU6biJRXQQrhee/Q= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771315811; c=relaxed/simple; bh=6ZCQAXFZ6ElbW2qGJlx67uGx5qEJyVJlaaRfoGBlv4c=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=uh+Tfx6Cc1LNBPpjVPc8nI64HWbefgPezbfmLUDeHud8DUs5deP2c5lTJ7tKPLI0DS6ss3urienYmZ+Uh9eaW1Uv69nIzt586toakYu3vt4HBYfexDqGECEMWUJ9Zzeoeck8ZChEgbbBOqlZNbcXv/uIuTDnOwxYrHAW2uin9gM= 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=hD5RlIgU; arc=fail smtp.client-ip=52.101.201.1 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="hD5RlIgU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=w/UqAFJwDhBiRtIKoa4+RgwjAEQQNgAXDNnXPAujx/IhCjhSWOhEcrWhyDIVlVNkO3lZ4eO7x+XtlIcLvYn15nbhUmWDJV5tD17QKd5l7HUKVHwx0ZCSsoJg5bwgWVc8zIyeMZ0l8kZQ2W6GG41k51bSq5t1glrpbJ9TvWU++Do2Nidll8baYrBndpUClUBYloWx/Wxxt3POI9kvGKvbxLkMRwxtxU6TPWvHpSdeRbWx9THa+bMuHWrG3CPhqEcvY6+OOgYC2wHwBLitQCqvhcsT/ZZAjNsejn4YApHzruytY3R9j5YwMvBAPFJ2ha4DiVgKnj6Ax8OG/Ud715GM+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=/PSe+O8yUuXLrQ4QyXIQz2Es+XFR3iDxoStjYEuB810=; b=KARqLUprUdZmFRXtRAHPpic3BqOmPFwcQyVckGpQxU8e9pRJitkdj1NbHPcdKPZjferVuGs0aE/W4/vWTTbcQ4HQVZHTOWKJWl23UmTOeXF5NUuWA4F+N+TYEJhD3cZeNZYzwUsrZ/9uEeTBEeQyhoVer5eyMVJ94Nl7+qs3FTb27Av//t9bZrd8/OJvmTGvbWN0tVIdNtu+asxG+u2YinrGQOcaqpPXTVWqvH2t0mSW4het1U3Db/ECdbb1fYJTDAYJQEFxYdjBZlrOqj26K6u6wXRnb84yMtBLPIx3Eq2FD0U0zOsp4Wu2Ky3NxOl7+L3xtlYWpsNajAQzO6wKCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.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=/PSe+O8yUuXLrQ4QyXIQz2Es+XFR3iDxoStjYEuB810=; b=hD5RlIgUzL6XUxEy5cGRT3/M2BTw6CySuvKbDOeBDAXG9R9SGALvlWsH8AP894l+m30PBFgfmTjX9bGYTw7mnJQit1oWXLoOkksYuikWNjSeHsc7P0Zs9igV1GxZ3IdrcdMw3/OVcNOz67Tc+ZYY3PtLN0ZyBOHo1eQbvrzAd8c= Received: from SJ0PR13CA0103.namprd13.prod.outlook.com (2603:10b6:a03:2c5::18) by DM4PR12MB6446.namprd12.prod.outlook.com (2603:10b6:8:be::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9632.13; Tue, 17 Feb 2026 08:10:00 +0000 Received: from CO1PEPF00012E7F.namprd03.prod.outlook.com (2603:10b6:a03:2c5:cafe::b0) by SJ0PR13CA0103.outlook.office365.com (2603:10b6:a03:2c5::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9632.13 via Frontend Transport; Tue, 17 Feb 2026 08:10:00 +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=satlexmb08.amd.com; pr=C Received: from satlexmb08.amd.com (165.204.84.17) by CO1PEPF00012E7F.mail.protection.outlook.com (10.167.249.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9632.12 via Frontend Transport; Tue, 17 Feb 2026 08:09:59 +0000 Received: from satlexmb10.amd.com (10.181.42.219) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Tue, 17 Feb 2026 02:09:58 -0600 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.17; Tue, 17 Feb 2026 02:09:58 -0600 Received: from [10.136.47.100] (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.17 via Frontend Transport; Tue, 17 Feb 2026 02:09:51 -0600 Message-ID: <6a73ac0d-1fc9-49a7-87a2-65951ab2c844@amd.com> Date: Tue, 17 Feb 2026 13:39:45 +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 04/21] sched/cache: Make LLC id continuous To: "Chen, Yu C" CC: Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Madadi Vineeth Reddy , "Hillf Danton" , Shrikanth Hegde , Jianyong Wu , Yangyu Chen , Tingyin Duan , Vern Hao , "Vern Hao" , Len Brown , Aubrey Li , Zhao Liu , Chen Yu , Adam Li , Aaron Lu , Tim Chen , Josh Don , Gavin Guo , Qais Yousef , Libo Chen , , Tim Chen , "Peter Zijlstra" , "Gautham R . Shenoy" , Vincent Guittot , "Ingo Molnar" References: <60a05a3f50d14a7bf3b968f62cca87893c5c552c.1770760558.git.tim.c.chen@linux.intel.com> <79755f7d-cc68-4189-b6d8-850378e54017@amd.com> <95923e36-4117-4209-97aa-a92b60f2bd49@intel.com> Content-Language: en-US From: K Prateek Nayak In-Reply-To: <95923e36-4117-4209-97aa-a92b60f2bd49@intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF00012E7F:EE_|DM4PR12MB6446:EE_ X-MS-Office365-Filtering-Correlation-Id: d395bb6c-f3d1-462c-b0f9-08de6dfbf21e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|32650700017|82310400026|376014|7416014|1800799024|7053199007; X-Microsoft-Antispam-Message-Info: =?utf-8?B?QlNydVVyUjEzWGlrVHM3bnAvNnptWk13cnRZVjBMYnFRcUxVcUVzaHlMUFFW?= =?utf-8?B?aUNSNjlIZHk4YnRIK2M4b002TDZDRzZYMTZhNVFXK0xJOC8wVEE4bEZpSGJC?= =?utf-8?B?Z3R2cmJaWVZGY1NSSHhKcWw4VjdHeXNPRzVVeTdPa2tGNkhVN0RLSThJT1pM?= =?utf-8?B?a1R5WkQvSFpPcUsyNWlFWjloY2g0WVJhbTZCT0x5RStjZU9jZEdxbHZWWXow?= =?utf-8?B?NHEyc2trejRpV2daREkySisrRmoxdXV6QjMwRDNERDRib2FGZUF1L3A1eUV0?= =?utf-8?B?Tnp3b1R2MWhiY1FOaWRIRHBBRmQ0SVdkT2ZFUTJBeTlJSVFHeWw0VDBJUENW?= =?utf-8?B?bm1zekw0am1MTHdvU1dHZkg2Q1hSNGFOdXRoRENxL0s1TGVRYUpLR3QwcmJC?= =?utf-8?B?YlN2cUozVENwOFg2SEFoYUJlOTNvTi9RS1REMVJFRVF1M2s1eisrZWltaW1C?= =?utf-8?B?Y3RraHhZWmxTNTdHd08zR3U2a1dvdlNubTliZzMySWRMQi9zV2Mrb3ArTk1J?= =?utf-8?B?dkRnRlRkVlVWRUVyQklvN0xndjZCVV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;SFS:(13230040)(36860700013)(32650700017)(82310400026)(376014)(7416014)(1800799024)(7053199007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XKO11c5JS01Wulron+CxVan5TO3lYwn8r7uG/SwmOFS+Tqh7kpV3PvEP1jXLQMI37hq0vSM5OiRUCcLN/9P5qq1TCPey1gpP4Z0WobkJQCzdP9W8Xt20sOr4BpzOwoN6wW4JtSdFyxGxydLzFspYQBh2J6ZamkTgUl/Zuz+yawu19vY72bU5Vx9a+3aFrru3JXkg0v2DQpdlgCMc6bRB7xYMXNkeZePOOB3yrZQmcwjTFFuqK1HOwt9B7Olyc09klGHI0poYN1WSufG34RKldBqmkUTnYHnPbBD82ggvOkXtF/kQmuhi6R9WCMr4TTW4Dp0ZxRCvpgc1WiB1kZEJI9o66O77Fw90PBaWG6Mmiza7AA+/Ed3C3zfkecud3N6qTAbUtgDVUbQPtactDL5inhXNBspIGZQRZRrSUSwWDpdw19WmtNuUx8iFUhbesnjG X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2026 08:09:59.8732 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d395bb6c-f3d1-462c-b0f9-08de6dfbf21e 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=[satlexmb08.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF00012E7F.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6446 Hello Chenyu, On 2/17/2026 11:37 AM, Chen, Yu C wrote: > Hi Prateek, > > On 2/16/2026 3:44 PM, K Prateek Nayak wrote: >> Hello Tim, Chenyu, >> >> On 2/11/2026 3:48 AM, Tim Chen wrote: >>> From: Chen Yu >>> >>> Introduce an index mapping between CPUs and their LLCs. This provides >>> a continuous per LLC index needed for cache-aware load balancing in >>> later patches. >>> >>> The existing per_cpu llc_id usually points to the first CPU of the >>> LLC domain, which is sparse and unsuitable as an array index. Using >>> llc_id directly would waste memory. >>> >>> With the new mapping, CPUs in the same LLC share a continuous id: >>> >>>    per_cpu(llc_id, CPU=0...15)  = 0 >>>    per_cpu(llc_id, CPU=16...31) = 1 >>>    per_cpu(llc_id, CPU=32...47) = 2 >>>    ... >>> >>> Once a CPU has been assigned an llc_id, this ID persists even when >>> the CPU is taken offline and brought back online, which can facilitate >>> the management of the ID. >>> >>> Co-developed-by: Tim Chen >>> Signed-off-by: Tim Chen >>> Co-developed-by: K Prateek Nayak >>> Signed-off-by: K Prateek Nayak >>> Signed-off-by: Chen Yu >>> --- >>> >>> Notes: >>>      v2->v3: >>>      Allocate the LLC id according to the topology level data directly, rather >>>      than calculating from the sched domain. This simplifies the code. >>>      (Peter Zijlstra, K Prateek Nayak) >>> >>>   kernel/sched/topology.c | 47 ++++++++++++++++++++++++++++++++++++++--- >>>   1 file changed, 44 insertions(+), 3 deletions(-) >>> >>> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c >>> index cf643a5ddedd..ca46b5cf7f78 100644 >>> --- a/kernel/sched/topology.c >>> +++ b/kernel/sched/topology.c >>> @@ -20,6 +20,7 @@ void sched_domains_mutex_unlock(void) >>>   /* Protected by sched_domains_mutex: */ >>>   static cpumask_var_t sched_domains_tmpmask; >>>   static cpumask_var_t sched_domains_tmpmask2; >>> +static int tl_max_llcs; >>>     static int __init sched_debug_setup(char *str) >>>   { >>> @@ -658,7 +659,7 @@ static void destroy_sched_domains(struct sched_domain *sd) >>>    */ >>>   DEFINE_PER_CPU(struct sched_domain __rcu *, sd_llc); >>>   DEFINE_PER_CPU(int, sd_llc_size); >>> -DEFINE_PER_CPU(int, sd_llc_id); >>> +DEFINE_PER_CPU(int, sd_llc_id) = -1; >>>   DEFINE_PER_CPU(int, sd_share_id); >>>   DEFINE_PER_CPU(struct sched_domain_shared __rcu *, sd_llc_shared); >>>   DEFINE_PER_CPU(struct sched_domain __rcu *, sd_numa); >>> @@ -684,7 +685,6 @@ static void update_top_cache_domain(int cpu) >>>         rcu_assign_pointer(per_cpu(sd_llc, cpu), sd); >>>       per_cpu(sd_llc_size, cpu) = size; >>> -    per_cpu(sd_llc_id, cpu) = id; >>>       rcu_assign_pointer(per_cpu(sd_llc_shared, cpu), sds); >>>         sd = lowest_flag_domain(cpu, SD_CLUSTER); >>> @@ -2567,10 +2567,18 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att >>>         /* Set up domains for CPUs specified by the cpu_map: */ >>>       for_each_cpu(i, cpu_map) { >>> -        struct sched_domain_topology_level *tl; >>> +        struct sched_domain_topology_level *tl, *tl_llc = NULL; >>> +        int lid; >>>             sd = NULL; >>>           for_each_sd_topology(tl) { >>> +            int flags = 0; >>> + >>> +            if (tl->sd_flags) >>> +                flags = (*tl->sd_flags)(); >>> + >>> +            if (flags & SD_SHARE_LLC) >>> +                tl_llc = tl; >> >> nit. This loop breaks out when sched_domain_span(sd) covers the entire >> cpu_map and it might have not reached the topmost SD_SHARE_LLC domain >> yet. Is that cause for any concern? >> > > Could you please elaborate a little more on this? If it covers the > entire cpu_map shouldn't it stop going up to its parent domain? > Do you mean, sd_llc_1 and its parent sd_llc_2 could cover the same cpu_map, > and we should let tl_llc to assigned to sd_llc_2 (sd_llc_1 be degenerated? ) I'm not sure if this is technically possible but assume following topology: [ LLC: 8-15 ] [ SMT: 8,9 ][ SMT: 10,11 ] ... [ SMT: 14,15 ] and the following series of events: o All CPUs in LLC are offline to begin with (maxcpus = 1 like scenario). o CPUs 10-15 are onlined first. o CPU8 is put in a separate root partition and brought online. (XXX: I'm not 100% sure if this is possible in this order) o build_sched_domains() will bail out at SMT domain since the cpumap is covered by tl->mask() and tl_llc = tl_smt. o llc_id calculation uses the tl_smt->mask() which will not contain CPUs 10-15 and CPU8 will get a unique LLC id even though there are other online CPUs in the LLC with a different llc_id (!!!) Instead, if we traversed to tl_mc, we would have seen all the online CPUs in the MC and reused the llc_id from them. Might not be an issue on its own but if this root partition is removed later, CPU8 will continue to have the unique llc_id even after merging into the same MC domain. [..snip..] >> >> It doesn't compact tl_max_llcs, but it should promote reuse of llc_id if >> all CPUs of a LLC go offline. I know it is a ridiculous scenario but it >> is possible nonetheless. >> >> I'll let Peter and Valentin be the judge of additional space and >> complexity needed for these bits :-) >> > > Smart approach! Dynamically reallocating the llc_id should be feasible, > as it releases the llc_id when the last CPU of that LLC is offlined. My > only concern is data synchronization issues arising from the reuse of > llc_id during load balancing - I’ll audit the logic to check for any race > conditions. Alternatively, what if we introduce a tl->static_mask? It would > be similar to tl->mask, but would not remove CPUs from static_mask when they > are offlined. This way, we can always find and reuse the llc_id of CPUs in > that LLC (even if all CPUs in the LLC have been offlined at some point, > provided they were once online), and we would thus maintain a static llc_id. That is possible but it would require a larger arch/ wide audit to add support for. Might be less complex to handle in the generic layer but again I'll let Peter and Valentin comment on this part :-) > > Anyway, let do some testings on your proposal as well as static_mask things, > and I'll reply to this thread later. Thanks for the insights! Thanks a ton! Much appreciated. -- Thanks and Regards, Prateek