From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from SA9PR02CU001.outbound.protection.outlook.com (mail-southcentralusazon11013007.outbound.protection.outlook.com [40.93.196.7]) (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 7D17F3148D9 for ; Mon, 13 Jul 2026 03:25:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.196.7 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783913140; cv=fail; b=LU8TAoRJj+ChqOweS+kFRxMNfBxr69qoCSykFvFqrGisU0iunfG0RYatNXT/sQp3gkoQuBpS6k1+Jtdswp8PhHKW1GDEurDN+G2w5Vz9Q/maek7o7pEKwnYhj8KFph7KGS/+5Q6lImgzCO6FHe8HY7IXjuIB6QtZkoe2mA4srXI= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783913140; c=relaxed/simple; bh=1JgAeBcEHsg8nZusvyrlZkRCWZrcXuto5bVm4Z3dReo=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=twb0v244WadWtHq7WTNTehdFf3abrshhbjR2Oka8gtJiepnzGKp2ghlX46r1FTpSUP0j5QjBFTHQCV/gMfTJYg1cSxlNQZ43YfcfSaKV5jZgI4C1RwdFoLkhcam2xCvxHVMJhnWEtcX4LooPULj0p/GoCl+wr/hbJkLyGq5SCH0= 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=Tpt7rQrO; arc=fail smtp.client-ip=40.93.196.7 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="Tpt7rQrO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ltm/OJkM8P/by0xgzs2ToTUkHYBSFXHKySQPK9dNxL24YQ5cyxiJ7stx+LGkuWhbc9X7IoY/WPzFCv7y5uYJoIE/t+DKw1JShs0GrzuNpvpG06QSE1LrppKMhtgXvKutBjJOyC9isA7tmd8wRqswuECM0RVUbSYA07pZ/fNnW2bOOZoXauVOX5ziR7xjwwE82ltIwyLkbiFiSYZfU2ZLdfK95Qpj/CEc9bdfcNGC2N4vSiKI7o5rZg9VeaXw/WBUwnxKDAK69+wBPUdptk+WCTvl2LTXXrJqbBHpG0zFxhyGAtf7NYlrezv9Uq4X8LEejm5nqFNypIvGWNPysaprIw== 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=IXe4PX97TrgSqo/KKV5CO3Qxh5bAqP5v6dmtFkjPFd4=; b=rb0ezOJ845p4nWwn5zPOALcQCy33Duw7q1LOYf6fJ2PBOh3EXH7Lf4vkbAevVkyW0h9Y/d9Yv1pG6H+Y3j1eGomkkVL0ws9Jd3uWg49Io3lHkpjm5h5KUJuJI900gd2046VS+GndbyYUtjQ3FrfKFEVoTKvkJmjlieNAVST8F8OQj4KRXNCgC0qI39AjVHIkttNUMawQVX7uOXjSrMdLXZUPc4WimsZ0nofuk7gBiiE0IKhvLcBspXVeSw+HBllDNJoHNmZG8qI7MPzmRi7oPOlgeQVqKO260dvlzmHdLvykXZT7dcWhgsg7qsF+cBDJprvhqNhgRmyisWYhpbYJ3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=huawei.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=IXe4PX97TrgSqo/KKV5CO3Qxh5bAqP5v6dmtFkjPFd4=; b=Tpt7rQrOB5+prmLOSi1TQQXmM1tW3eG0CDi9DdaE6HtNke2ULM/PvD1jhnu3Nfamcgb3hViJrMezv83ApiDhqh/zTrfTwyBuwL8Z7O+IjoAMqz6nxd/CrUDUOeG05cT70ZtbJqA2+ENuJtNeqQ9quEOGn6izxE4YUhgofQQmTA4= Received: from CYZPR14CA0018.namprd14.prod.outlook.com (2603:10b6:930:8f::28) by LV8PR12MB9153.namprd12.prod.outlook.com (2603:10b6:408:185::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.181.17; Mon, 13 Jul 2026 03:25:29 +0000 Received: from CY4PEPF0000E9CD.namprd03.prod.outlook.com (2603:10b6:930:8f:cafe::4c) by CYZPR14CA0018.outlook.office365.com (2603:10b6:930:8f::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.202.19 via Frontend Transport; Mon, 13 Jul 2026 03:25:28 +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 CY4PEPF0000E9CD.mail.protection.outlook.com (10.167.241.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.223.9 via Frontend Transport; Mon, 13 Jul 2026 03:25:27 +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.41; Sun, 12 Jul 2026 22:25:27 -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; Sun, 12 Jul 2026 22:25:27 -0500 Received: from [10.136.35.249] (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.41 via Frontend Transport; Sun, 12 Jul 2026 22:25:22 -0500 Message-ID: Date: Mon, 13 Jul 2026 08:55: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: [PATCH] [Question] sched/fair: Task starvation with RUN_TO_PARITY_WAKEUP under group topologies To: Chen Jinghuang CC: , , , , , , , , , , , , , , , , , , References: <20240325060226.1540-2-kprateek.nayak@amd.com> <20260712113106.2564384-1-chenjinghuang2@huawei.com> Content-Language: en-US From: K Prateek Nayak In-Reply-To: <20260712113106.2564384-1-chenjinghuang2@huawei.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CD:EE_|LV8PR12MB9153:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f5a0687-f728-47c6-3a6f-08dee08e629f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|36860700016|376014|23010399003|82310400026|1800799024|13003099007|56012099006|4143699003|11063799006|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: 4k2el9rawoWm8T+xZ4V8PoWFOuTgPxfMaBEvb+elYZpbjTVRZEUEHvPkxsxjZzsYHp3DP0wWJTS+TklwoaQAaC9LE9C8pGP7jM3rpwkyFBaIwX6v+z6v0Y8VeGCpoWnSrYME7rCXdCvLQ8QHgqOrOW707VOIJlaTHAw34YF4XuuczUDL2eyPL9Cpuo20TVgo+8mUWhzv8xYxcKcJs/BXy68kkhYoFjWqvInYS7UJS5bfUhkBZLMVkmcY9t4mimEXawAebp/5lFH0o0oLNRuAfmav6RDdhmb3Sv4CQWP5atwFcXnxDWn07kB585LFNKC9iuIlctS0xcFkbjlH125dr2cNOC9SAepp1FMOULqD3qySpWHu8dhBlJa5Kxhy9C3Z8G+dz49p5S532TXL2vEwNGfYfZkrNh9sobyX2ImSYkCwwyd2Co5BgwYU8jYJrQixkvxvtdKAapJlNTgT4cfFjNHCPZ8Ac/CSPGYXVS9TJ2zOdNiVUnoCDisgapve6tuGriZOe8m+mf1bfL5kk9Ctz8gX/9sGowgJZ1WINIL7kIxbDF4l5+LSevv/HL0q2w+1tZGndcBuqEqijR+b3QYHUQiFzxmgEBUFbiwd7z4/ux39cpeaiZo00q3H95H8VErtrT7bDUmlyHy95s95RfSuDDvGQ9AbJ3ZW1reXTw99yxXLnm9nXlOFLHhdllCbUE0z1ejQZAtYrc29ZYmwjp7/tQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb08.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(36860700016)(376014)(23010399003)(82310400026)(1800799024)(13003099007)(56012099006)(4143699003)(11063799006)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: extlkYpiG94p42XW1v5MpiEeHSy5VFUchPVWaGq6KuhXIv7P15hLyWWfNEEI87z79iP3nqPKTsJJNI7mC+b9VYV1RKEU093V4FRXCrBPd12M3qD6Kw7XtnpNq5pYXOb75FhiygLfcioh/L+RUz7Hqbp96Fix1kuDmiIbH6jw4a51yVVXqm4kFPmxQ/TviQHS/wMfg3co8/KdddGr5a8GfdAuxdbnTR9kzmCS7V3t51dWfPuI71ulEeSJhE45mXwJPzk0sc/00DgT7ZPHelLKPFFTaC4W/UhrUVPFL+eF+t+ZSRax6iL8LOJ/dLarOi3vLN/4tejWntQNTosFP7gvtDDqa+LnlmzX6qHKXx0JfRyGLcAjyFw+qA+84Jtj1Ehnec9ky/+9nH33zqyQ9WWG4mMxV7ku9AhcMhutMcTSPeZqjszq3Un7N8aVHjYj2mqN X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2026 03:25:27.6880 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f5a0687-f728-47c6-3a6f-08dee08e629f 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: CY4PEPF0000E9CD.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9153 Hello Chen, On 7/12/2026 5:01 PM, Chen Jinghuang wrote: > Hi all, > > While adapting the RUN_TO_PARITY_WAKEUP feature on top of mainline v7.2-rc2, > I encountered a severe task starvation issue under specific cgroup topologies. > Specifically, a running task completely hogs the CPU and prevents any > preemption. I'm assuming you are referring to https://lore.kernel.org/lkml/20240325060226.1540-2-kprateek.nayak@amd.com/ There was a reason it was not mainlined for this exact issue. ... > Discussion: > I'd love to hear your thoughts on how we can fix this issue without losing > the throughput gains of RUN_TO_PARITY_WAKEUP. Run your tasks as SCHED_BATCH and they'll forego wakeup preemption. This is the exact recipe that had helped a bunch of workloads that suffered throughput degradation from wakeup preemption after EEVDF was introduced. If you have well behaved workloads, you can also play around with custom slice (sched_attr.sched_runtime for fair tasks) which gets propagated down the cgroup hierarchy and should be better behaved. > > Thanks all. > > Signed-off-by: Chen Jinghuang > --- > kernel/sched/fair.c | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index d78467ec6ee1..00869624d914 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -1157,7 +1157,23 @@ static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq, bool protect) > return cfs_rq->next; > } > > - if (curr && (!curr->on_rq || !entity_eligible(cfs_rq, curr))) > + if (curr && !curr->on_rq) > + curr = NULL; > + > + /* > + * When an entity with positive lag wakes up, it pushes the > + * avg_vruntime of the runqueue backwards. This may causes the > + * current entity to be ineligible soon into its run leading to > + * wakeup preemption. > + * > + * To prevent such aggressive preemption of the current running > + * entity during task wakeups, skip the eligibility check if the > + * slice promised to the entity since its selection has not yet > + * elapsed. > + */ > + if (curr && > + !(sched_feat(RUN_TO_PARITY_WAKEUP) && protect && protect_slice(curr)) && > + !entity_eligible(cfs_rq, curr)) > curr = NULL; We also have a bunch of changes in tip:sched/core that improves wakeup preemption with custom slices. You may want to check them out too: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/log/?h=sched/core > > if (curr && protect && protect_slice(curr)) -- Thanks and Regards, Prateek