From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from CH5PR02CU005.outbound.protection.outlook.com (mail-northcentralusazon11012036.outbound.protection.outlook.com [40.107.200.36]) (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 76CE540DFB0; Sat, 21 Mar 2026 10:13:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.200.36 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774088013; cv=fail; b=VsJiS6i5AYx8YDCivzpP5xdcat2SDUCtsmkGI6UfuytHY0m+TIyf3WmzOMlAVicumNjiMhmMWS0NAIYGKGlrXTnDnvjsPGZRC/sfQwCsEOSOr4G5Z2+zNtJmrkdPgfymYIh6Vmztr0h61jpW3AxIPw1OwQzOMxSKs3HHJBM40Mw= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774088013; c=relaxed/simple; bh=ot73XYPsFZ7Vfp1tXcssJMn51FiWnoHqQ22kHrFujZY=; h=Message-ID:Date:MIME-Version:Subject:From:To:CC:References: In-Reply-To:Content-Type; b=FnpmyTfdFelk7YYPQNzg2o0YKhzyWOlaDgyPjJoU71DXVKiYHACM2mkW28EAyi2ZW7oWsO7wsL2odhtJWNwyDpVTKSq807aK2sSIWlRikZYhb5WJ2EjSzVgAWtOUV14I72b3JtM72msG/dh3MliCn8e1oUKgMMA5aFoZLmmlTcY= 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=JF1+eoJg; arc=fail smtp.client-ip=40.107.200.36 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="JF1+eoJg" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MoHtBFSmKrmUJMH4xweMvuYJBxocfaLFj7p2TGgIC726KWRLHHLYxIebkJJjhP2AgAKCDhZV0tsckoW4ubpHuNbG+wyzs2q88P1rXVzvtucqYQrcearU5CvuHPjr+cVbc4V19uJmj2XX7Nui3zn6v1/GyoXfz2SGqx9OLTstecrFcft4hPphCI4apM6OSBblGRq1RpDSAAegyjT2rDOvd2cpHnoLChMAe7SJIgb/AaxQEWSs7EufUSMiyHv8xuWk4hpedJNegJGWP4Fba7+7VHN6NRm2I4oM54bsGAm915WBgufNV55/IWWSEn7xLiiq6iZ+T0capAinUTeYs1ViVw== 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=2cdLZw5t7T9MiF93Cxsy4xwVwV0Eyvqa313vIPEFg7s=; b=Sur6fagPUFKEOPF3qSXWySXLQ5mUeM8GzKCCHPwhHORYQ4ImshP+r2WWKRnV+Dc34scISWNrlAXWCnTXnUJkEa342nRxQHMw3nANlGS3rVCNVF3PuLLraXVDW2GGssMzClhJ1+Q28s+0AGu7lvHuRdfzSVM6h76XHYi6KE3Jd9/zurDvRbfivlb+NR2XGMszp8HIdeFe/QHvFtO/4hRT0REaBmTSkeC2DtJPMDzajbBkhoWXLgJWhPMk0iC/Fyg4EZft4+ksQZJC/d3WhjrWP2iH1PyOHp8l7yXWssgsqalLVz8REwk4A7bT+xW7L0lR7M8qVeXdX91VutqigHsQPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=infradead.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=2cdLZw5t7T9MiF93Cxsy4xwVwV0Eyvqa313vIPEFg7s=; b=JF1+eoJgfUGj5m3WGB9P2JH/uthX1774LUZCZ7yIzaO93L2FKe3RKznonkYF3VvStHmJSnMVw4mKTgisHbH+U/nmHL5ijhrqVLphZ+ZLawAolOYugN04zwcimJ6vMSGA+RrsgKO8Ij5dnx6JdNZhKsAnSCiCOthTXjqltABga84= Received: from PH7P222CA0024.NAMP222.PROD.OUTLOOK.COM (2603:10b6:510:33a::24) by PH7PR12MB8428.namprd12.prod.outlook.com (2603:10b6:510:243::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9745.9; Sat, 21 Mar 2026 10:13:26 +0000 Received: from CY4PEPF0000EDD7.namprd03.prod.outlook.com (2603:10b6:510:33a:cafe::a0) by PH7P222CA0024.outlook.office365.com (2603:10b6:510:33a::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9723.23 via Frontend Transport; Sat, 21 Mar 2026 10:13:26 +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 CY4PEPF0000EDD7.mail.protection.outlook.com (10.167.241.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9723.19 via Frontend Transport; Sat, 21 Mar 2026 10:13:25 +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.17; Sat, 21 Mar 2026 05:13:25 -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.17; Sat, 21 Mar 2026 05:13:25 -0500 Received: from [172.31.184.125] (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.17 via Frontend Transport; Sat, 21 Mar 2026 05:13:22 -0500 Message-ID: Date: Sat, 21 Mar 2026 15:43:16 +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: [tip: sched/core] sched/topology: Compute sd_weight considering cpuset partitions From: K Prateek Nayak To: Peter Zijlstra , "Chen, Yu C" CC: , , Shrikanth Hegde , Valentin Schneider , Dietmar Eggemann , , Nathan Chancellor References: <20260312044434.1974-2-kprateek.nayak@amd.com> <177382132440.1647592.1849180094328011054.tip-bot2@tip-bot2> <20260320235824.GA1176840@ax162> <60406550-d90e-4efa-a4d9-f901421887f8@intel.com> <470ce693-ee2e-414e-930b-d6581d649110@intel.com> <7fad91ea-e6cd-43c8-abe3-16d7843247ed@amd.com> <10204982-a007-4f44-ab12-bcddfe4140c8@amd.com> Content-Language: en-US In-Reply-To: <10204982-a007-4f44-ab12-bcddfe4140c8@amd.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EDD7:EE_|PH7PR12MB8428:EE_ X-MS-Office365-Filtering-Correlation-Id: a847b231-6424-491a-c17e-08de87327d91 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700016|1800799024|376014|18002099003|22082099003|56012099003; X-Microsoft-Antispam-Message-Info: BnSvNn/w0u6N5udrw+CThXKMYz6MJesiFlgqlTgQszk2XEkwy/B3HYAYLCXcopdTNoa5Q0VdHYlI6e5ddzh7ingNd83Mjzxsznp/TKoxffG46Gbl0Hv1QBNN13WiQLDsy7YcHoR+wlQhGWK9vPRBdcr32mu3MpyBEu5Z9gkqDTNcFVHy48S1J8W6Wf3w1XiFeG6xhyysCmA1/0Kv3jNgW17bVg2oNf3U12c4RLJPcGtmlkAD1NIjZZh72GTg/e8ACRPAA0TSykOjiHMLCk/X78OcNLJTpEuahdD+oa1HTo8OC5i6IwW2MwNyCCnusntkeSnN+BHGZRY+HaZC/5xV6XuE58M9UoIm2w7UjsEZWB5hcm3oMAs2e4g+BjfQfC0ON5BaN+JQJseZbNbFX9xxxkZkT44eJ8Kl8x9kFgAwg9m4Ako7BR0QuPLu1vXtUer8q6zWTlg25ZP9FOVJIewmAyYZQ3tok5whmMK6VxM5MLWokCu9hKPIBK/nusCcbA93cKKK9DcRfwFpo2RQ6kHWXfgjudHTWV8gg5VS8Wpf7kYMIv+UE/vWgwSsAcj4dwoDRvVy/pHamztqWi6JzzT41vwM/Uw1S3tcSDmzLNFVsiAhn8YwONKy12lwVXFMLec4o8XfS2QLW2Vb+gywQUsyQsQ6i7wBJjmh777id0XT7ZGvi3Gr1NblXjKxsEkIDZ7T93ko/bAJq098C9bB1oYhwcEn0DCgaeNWJjMulf5rr8WyQsDWK/FoyRDqiNmtTaOkcETeraEpoUj0lozZbeT10A== 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)(1800799024)(376014)(18002099003)(22082099003)(56012099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /la+TZjU9+nOoYN3pDCNn6euQG7vwGLum4viOVDlZEss1hqyTMcjkatTYQqwGTb8esMEI2rNE/5Z+UnfsvjfVvzivRHafgF6UtN0602atL2hB/m1j8kS3XgNzGiGe9qIfRmZReTHyBBOqr88juEPpa8lcF1l5ffIoAVgFIgJlZUJbnvMFpP+BndWn6Rw8Yjynx1Z1xmOCEl+lGynUu4AZgjOtogM8DIYvzqEEeWYAicFhHVpMgT4OwU+OANYIRj7BeP0J/79ZxxmYVnCv5AQe553ChYw4rFwvtXT/fdoDyTyImP3T5Q2hAmVKv8r3HPeTGXLpnyaNwhuZl7cd1hvsUp3c+Uh+U/3WblMMzShJvS/ljc1RTM7whR0+kl4+cUyIaBs+xlMw+wKq+nAwjPMihmkcMnkXD2Cswc4IC7nEYUBp3MeakJznummdSPFsKYF X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2026 10:13:25.7135 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a847b231-6424-491a-c17e-08de87327d91 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: CY4PEPF0000EDD7.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8428 On 3/21/2026 3:15 PM, K Prateek Nayak wrote: > So this is what I've found: By default we have: > > cpumask_size: 4 > struct sched_domain size: 296 > > If I do: > > diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h > index a1e1032426dc..f0bebce274f7 100644 > --- a/include/linux/sched/topology.h > +++ b/include/linux/sched/topology.h > @@ -148,7 +148,7 @@ struct sched_domain { > * by attaching extra space to the end of the structure, > * depending on how many CPUs the kernel has booted up with) > */ > - unsigned long span[]; > + unsigned long span[1]; > }; > > static inline struct cpumask *sched_domain_span(struct sched_domain *sd) > --- > > I still see: > > cpumask_size: 4 > struct sched_domain size: 296 > > Which means we are overwriting the sd->span during *sd assignment even > with the variable length array at the end :-( > And more evidence - by default we have: sched_domain size: 296 offset of sd_span: 292 sizeof() seems to account some sort of 4-byte padding for the struct which pushes the offset of sd->span into the struct size. To resolve this, we can also do: diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index a1e1032426dc..48bea2f7f750 100644 --- a/include/linux/sched/topology.h +++ b/include/linux/sched/topology.h @@ -148,7 +148,7 @@ struct sched_domain { * by attaching extra space to the end of the structure, * depending on how many CPUs the kernel has booted up with) */ - unsigned long span[]; + unsigned long span[] __aligned(2 * sizeof(int)); }; static inline struct cpumask *sched_domain_span(struct sched_domain *sd) --- and the kernel boots fine with the sd_span offset aligned with sched_domain struct size: sched_domain size: 296 offset of sd_span: 296 So Peter, which solution do you prefer? 1. Doing cpumask_and() after the *sd = { ... } initialization. (or) 2. Align sd->span to an 8-byte boundary. -- Thanks and Regards, Prateek