From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from CY3PR05CU001.outbound.protection.outlook.com (mail-westcentralusazon11013067.outbound.protection.outlook.com [40.93.201.67]) (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 AF000306D3F for ; Tue, 2 Jun 2026 08:58:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.201.67 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780390691; cv=fail; b=EQhynb5P+4Ck40W34C53SjXWmv6CYKS7LDDaEJJ4z43yB6TsW/Hf2e/dv3GsXHcAS16DZkD6WBQlB/ftKz+eLkU0uOgOJH97lE18NXSKyQEVIeg+3A1s9nNC3PnEEPB4NNSBTK501DdOp2EQfZh3TjZZ47+J8cZuS3CmjeeCibo= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780390691; c=relaxed/simple; bh=7JjamlijMvT83p5uWdB98FcVIjchiNAuG4HHXkBzeqc=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=eqsev/dHcLkr9PS02mgDIMxJOJEQXG5hMapHCXTqiTohqk6eiq6vMWmNCCnuufbDnDTI9oM601eWzEDdf6VLViiq0dMwJrB6PsXpi95pC/qO+OJ/Pf23gNVbjd87J1Oa5JO2zcj/3W9VJWOwAoL1+vSObHy1iHIUugGr/3u0MDU= 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=qSg267Je; arc=fail smtp.client-ip=40.93.201.67 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="qSg267Je" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cxfsgLLR43BwCf1z7R6vR2UdZNrVYoEYGNe7i++5dEcY2endjGXR3c3JdnvNuZqmegCWivMfABBsw0A8qwePQBkZagihA7q8Dbb3L6VyBaMZJR4iUQ/YIzZuN2w1pc+VzzwZoITzEbiHD4kJLvFuirixHSP9OGUeKWvvu7iT2fu982FQXh5QFrGlP7VOzzLVat4RIZvhf64PdecQyRVj7KUxHxCnjgf+iZWknEnHz5GnlJchRjzZaf9aSiuNe6OUXTWZJDr49u5iGXwmAdUXkNa7jL256w2Ntnsozn7ZUa6EvkJHXGUQiBzdsMDV6ob4b97ufIo8VbBN4bWls2a7sg== 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=4AwfQ4K8XUkjjzvbYbdvHauGWP9Qz/XzOByiZCEmpgo=; b=DH/f/YhKU19OJCcv6wcjZawj4RZ8SM+xYGm4hCRUuoboNZKbo2O7dX9JdfsYQg1s09/+lP7PNsQjVZ6+19/rgjrcGJGA+CNzIETnPMBkK/cykm6FkWMaYF5IQ7Qe5eiaaMwxMLH3drrwXG3lqhR0+UAQMvhr4XcBVVcTMqwl5nV088qMaSHUGiPiNSD7dintAM4NehZyhZBA5+eZE1FelJip1yhPBDbLj9/y7SAJnmRCHktxl9Eleu8CwmeSLe8HuejK3SfWED+EfuqKqSX2dEKNpNB2ivJnN0KPfCrDGq6UYRrf5yf+gsLZ0TVmb3x0BPt7UuPpeJLs0oC/Q1vkoQ== 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=4AwfQ4K8XUkjjzvbYbdvHauGWP9Qz/XzOByiZCEmpgo=; b=qSg267JeUrFx+VdyX0oD9TPSGg28ZOO9dD7truSW8XNWbL36qepw+QJFBNKkfz6fFuMmHjs+2haFAFpr/DDfZfwJVYPPPwa79zGXG+Ou4OKNWOUcyqdPU3joCCZk+yjuUznGB+OzNkZt3AlVoNyhKweBSNbX4qkcVIJZCcIOa/A= Received: from DS7PR03CA0020.namprd03.prod.outlook.com (2603:10b6:5:3b8::25) by CH3PR12MB9077.namprd12.prod.outlook.com (2603:10b6:610:1a2::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.71.16; Tue, 2 Jun 2026 08:58:05 +0000 Received: from SN1PEPF0002BA4B.namprd03.prod.outlook.com (2603:10b6:5:3b8:cafe::20) by DS7PR03CA0020.outlook.office365.com (2603:10b6:5:3b8::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.71.17 via Frontend Transport; Tue, 2 Jun 2026 08:58:05 +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 SN1PEPF0002BA4B.mail.protection.outlook.com (10.167.242.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.92.5 via Frontend Transport; Tue, 2 Jun 2026 08:58:05 +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, 2 Jun 2026 03:58:02 -0500 Received: from satlexmb07.amd.com (10.181.42.216) 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, 2 Jun 2026 03:58:02 -0500 Received: from [10.136.34.155] (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.41 via Frontend Transport; Tue, 2 Jun 2026 03:57:58 -0500 Message-ID: Date: Tue, 2 Jun 2026 14:27:57 +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 5/5] sched/fair: Unify cfs_rq throttling via account_cfs_rq_runtime() To: Peter Zijlstra CC: Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Aaron Lu , Josh Don , References: <20260528094830.13291-1-kprateek.nayak@amd.com> <20260528094830.13291-6-kprateek.nayak@amd.com> <20260601134842.GP343181@noisy.programming.kicks-ass.net> <20cc9820-35b2-4d97-bbc2-84af56802dfd@amd.com> <20260602083239.GU3493090@noisy.programming.kicks-ass.net> Content-Language: en-US From: K Prateek Nayak In-Reply-To: <20260602083239.GU3493090@noisy.programming.kicks-ass.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002BA4B:EE_|CH3PR12MB9077:EE_ X-MS-Office365-Filtering-Correlation-Id: 3bb4b8d8-6643-4df2-07a8-08dec0850f40 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700016|7416014|376014|1800799024|13003099007|11063799006|22082099003|18002099003|56012099006|4143699003; X-Microsoft-Antispam-Message-Info: MM+tCeVhmQM9TcJiTn8ZwxoIgBAdOgMo5sRvyRr9B/v62U8FtzIyAKUVqHW7ObAw6GkdExZ6djQPyHieB2iD++EG72A6x5kNjNqWseffWwG/ZNptZtdd506iSi3/k7Oy+/mysztVwGhZaBIlCVgQIBcECy8Hwa0e8IKqvS72o237SstEERLMhv/YrTV08cHJ/Qr4Hk4JXHgV5D0HCouLjmo1d+m2DpFsXHgD8PdE8S95trwpnJKsVEt6TvGZYQrjM1aDSQVRaNtGw53t4G37y85VOChtbyVOS7+eSe+pTx90BRoGBjMB97X2oPyY1saR8BdIpjKOIReIPo62NV2ZE5es1dg+jt0FCt/XUZMQ56jwxP+s/tEPHblmh3TS1z6kwPS3FNhhk+T/c0N/nF0iHe33v0EIicdeR2/phOMa5JsVVaB1fPvcNUjhNW8KHTiYUW7UFSsMl0Odyv63cfMD/XgUIo0221ESVKwHN0guKVI/TpgdOzUtlSl3TeK3BYo+zrZXZCcczuwEzc5NKcs90/VIqaFHwVL4DpoNGyhBegXMMkzSxss09+1W/pfN0dYtzCfUC69K4fuMM6W6bO4YXj5G6aM9enyWLtkblvhX+VEW73gF+oBCJRG6Gg8kuxUAugYqTxacB4vqg41afMGH+DrrcQu9/MzzQBMkwQHtxCD/HDf9z6v7aMvtmU0byU4GPkgIuj1/XZWf5mG5rLB46RPbAyStqWZYosKavKoC//I= 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)(376014)(1800799024)(13003099007)(11063799006)(22082099003)(18002099003)(56012099006)(4143699003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wA6pSUCZfIFua8Fk8QCtBRRGX5QvdrM83U8CXMyFbGluxrTdHU4I7PTJS225Dy6YyKCVReTP+YwtWAHv92jn3SHmC5ASYJqFSto6Unhr3nEWakf5sq/680MKuurTPlof+ZijNLA4jKMP9aTVnOGghexv4ZPgnVy498lGK1k9rbkbKBb/1/TdSoSL3EmvtG1rf/IIDBMDkWbO3CcMjuzsGy60FCsAYPSHIU2H11ukoJjYY4v3LZkiSkFGz7dziaVnvxiy52QXLcrerSE4oJW8+koqQWaT5P26mUAT+irlcaGdNSo+K3Rb/XKxmOk/supOmPuso98a8JF3pErr7uIQTqKg+fd4VinBHRIczvtag2Ew7TaxbBuY+NZNZrvf0uL9Tb8ugzW3uhBlNs70xOYMK63gI5eepBCzgVf5YkKXSjCvlvGtMniJZIvBLKrlDEZY X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2026 08:58:05.1897 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3bb4b8d8-6643-4df2-07a8-08dec0850f40 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: SN1PEPF0002BA4B.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9077 Hello Peter, On 6/2/2026 2:02 PM, Peter Zijlstra wrote: > On Tue, Jun 02, 2026 at 12:31:36PM +0530, K Prateek Nayak wrote: > >> My mind is taking a while to grasp the ->pick_next_task() removal. >> >> [1] https://lore.kernel.org/lkml/20260602050005.11160-1-kprateek.nayak@amd.com/ > > Yes, I'm familiar with that struggle. If you can manage to write a > comment that clarifies it somewhat that would be awesome. > > I've tried, but every time I read it back after a few days, I'm just > left more confused that I was at the beginning :-( Here is an attempt on top of v2.1: diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index fa8c0b1a1cf1..9a14d75ff671 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9889,7 +9889,13 @@ struct task_struct *pick_task_fair(struct rq *rq, struct rq_flags *rf) throttled = false; do { - /* Might not have done put_prev_entity() */ + /* + * Might not have done put_prev_entity(). + * The cfs_rq gets throttled here or via + * pick_task() -> set_next_task() where + * sched_cfs_bandwidth_slice() worth of + * runtime is requested for cfs_rq->curr. + */ if (cfs_rq->curr && cfs_rq->curr->on_rq) update_curr(cfs_rq); @@ -15003,7 +15009,12 @@ static void set_next_task_fair(struct rq *rq, struct task_struct *p, bool first) break; set_next_entity(cfs_rq, se, first); - /* ensure bandwidth has been allocated on our new cfs_rq */ + /* + * Ensure bandwidth has been allocated on our new cfs_rq. + * If this hierarchy was freshly picked, update_curr() + * was skipped for this cfs_rq. Request for the correct + * bandwidth slice now that cfs_rq->curr is updated. + */ throttled |= account_cfs_rq_runtime(cfs_rq, 0); } -- Thanks and Regards, Prateek