From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from SN4PR0501CU005.outbound.protection.outlook.com (mail-southcentralusazon11011015.outbound.protection.outlook.com [40.93.194.15]) (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 0182937F8C4 for ; Thu, 30 Apr 2026 07:50:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.194.15 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777535411; cv=fail; b=HdqNIvWA6vK2qLV+b6Cubj81ggbkQq/2BFE/HKAm4qdoxUaW16Cadgv8UfRckcahil3nvxsOqCdMg2kAffzKtT/1CW+EOrfRZ/bHwywko8xuR9LXO9wD9USwZ0QMSMJtJdBLB8RR/zlD0KNt1+KM0GRD7MGJMCUsC0QeXdRV3KI= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777535411; c=relaxed/simple; bh=L6eHUgF4uORLXwBMds0Z0JJkcYrDbgaJqqHbYoHetQY=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=k3BrgLr5Mnhlv5X6frd5ycGxQrdE6sJPt+bal+Qczowl4YsEu0FmNMgpp7Y3ym1JxUQdmGtV2BREQ46bQKStEFmUL1E2tLmY5ZLyeDxnD5ZvjgqsGY3KSevIJEKf3kRlNot9XEcS3NW9wSslJh8a9IBvF6nlZWo8c0XZQR37+eA= 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=Uh7KESLS; arc=fail smtp.client-ip=40.93.194.15 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="Uh7KESLS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lGSzq4ZHDbHNXDB3jMRZxRaSovqTJBEQxpRPkyIysp+MHMhlwQ/bft12I2BG+m4crjHsmTYHek6aUYsI4+kMtjM2ZWM1nyCfdpdYt2f52iUBn9pHVc2Lie8r4/AreS/cKSgXGgRhSv2qqlMzzsp0yBelLQn/f4FszFKpIireEQ0mnAy11DNtYVz4AX/bwg9stHuROfTrV/yRA8O167cT4GSSuy4Hd3MF1Ugb7vibdqodwtr9uSceDqCxkqhme5Qh/SHIJTVLTeD4/r1KolfK7+b9UTrZW2GBJmNiwvreYpUBDCYKpunIWSXKvY+RqFaGY6ySOM3YnzbSwBI1XMNQJg== 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=pAaMZtX5fegKuJ6LNkSIRYy2EjI4vst1vS6zKB3xthE=; b=wqSfNCL3U6sWCksmRctcjmdfGjJ9MlnH5LLoA/AxP0sk9cvq2pYzZxfx6OKfK2rUPuvXl9Cv/jTIOxrKndsIVif8p29O1FVGox/HwSPsqZXwPPUL/9coqJL2UWjJAIi1AmwQWI4lOwETZa0MGR66gM0S/K/6Ngs+QqKs4/fj+wuGr/lCT5g3M6elaUiklRlyLLqGrsrH66bOzaud3R9MGds8OBoEgEB0fx6STMS5Z+xM3JFA394OCPIl0uZgDOhp/f9cLt5oeKHiJhp2lBWnfXAL5cr8HkOkiO5GPzTxFIJfQD1V2QVsy2af1ChoXLN2EXG3eFab8mjYeB6xSepYrA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.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=pAaMZtX5fegKuJ6LNkSIRYy2EjI4vst1vS6zKB3xthE=; b=Uh7KESLS9q0tcmDkc22S3cC3ZqOjf/hBxUi63SvfBzIocKJ/HRScAJxoyVk1PlFpdGVldR8yX/pFo2yNTVnltPGetxpq1byOW+SrKfNHDkUBGrKko4F1dsOeoQyIDBTvMQ7OH4p4EW//OYtdyz7rsfoFZlOfFI94RHO0u7LHXmA= Received: from BYAPR02CA0006.namprd02.prod.outlook.com (2603:10b6:a02:ee::19) by MW4PR12MB7263.namprd12.prod.outlook.com (2603:10b6:303:226::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9870.20; Thu, 30 Apr 2026 07:50:04 +0000 Received: from SJ1PEPF000026C3.namprd04.prod.outlook.com (2603:10b6:a02:ee:cafe::7) by BYAPR02CA0006.outlook.office365.com (2603:10b6:a02:ee::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9846.31 via Frontend Transport; Thu, 30 Apr 2026 07:50:04 +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 SJ1PEPF000026C3.mail.protection.outlook.com (10.167.244.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9846.18 via Frontend Transport; Thu, 30 Apr 2026 07:50:04 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.17; Thu, 30 Apr 2026 02:50:02 -0500 Received: from satlexmb08.amd.com (10.181.42.217) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 30 Apr 2026 02:50:02 -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; Thu, 30 Apr 2026 02:49:59 -0500 Message-ID: <06f3e135-f706-4b6c-8fce-40f562116939@amd.com> Date: Thu, 30 Apr 2026 13:19:58 +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] sched/fair: Fix wakeup_preempt_fair for not waking up task To: =?UTF-8?B?RnVya2FuIMOHYWzEscWfa2Fu?= , "Vincent Guittot" , , , , , , , , , , References: <20260429164102.1388139-1-vincent.guittot@linaro.org> Content-Language: en-US From: K Prateek Nayak In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Received-SPF: None (SATLEXMB04.amd.com: kprateek.nayak@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000026C3:EE_|MW4PR12MB7263:EE_ X-MS-Office365-Filtering-Correlation-Id: 6be765bf-2d72-4eda-722e-08dea68d1753 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|1800799024|376014|36860700016|82310400026|22082099003|18002099003|56012099003|921020; X-Microsoft-Antispam-Message-Info: 6ZQZas3gLX6cFWz0saT4jSbamx5uiTFZBXABVO1tTW9PznRRros7PzYvTuey9KbwmjfJSKoneqG1mj/r3UROv/pO41E7zNGRZkL5s/KT+G0Brjj6f4U2+OJ+tQW8o58ijBcq6lLghUJ69163O7ZvpJV20ca84bNz4MjNm8YpLtUB4E5EdMSezLlV55I66aBDeMUOx9IeqRH6lFnCgWWMRUB32H3oouIkuHZbEpCMZuoxa5r6i4kgwA5fSkYikJKbZPrGGXmfxnoZhMfMWZ6qi0F2A6H+oPJTHOq7MjwpNqoYImz7qEHFjyUO1d9JvRbvjx5BegasUQOGmMsS7AOoK4p/d8JhBaaksEMkRMasCBkGv16KsBpeYiBdtVdpR97SoaGBdhCm0/DApMcS8KH4iGSwF7QOU7A4gUbt6ieJwSDhlC0Y/qffudC/0t9ULab/gchSe+E46sQCO7XxN87PPOJqyJuVqwsDuvr/AKYFbegldVdgUtYr5k/lKTSc7NVKDJ/coxd2hOWocs1stGDgQofvkfjrqbSF5bA6EiO88U++ZVzpix891Lx1rcW99Q6WDUT6gy5R/WXVv7E4fSx+bKffTuWrZUPLkAoNSVkcepZE24J+Nm7fB/+M/ACm7GJ5HY5EhVeTf8dPYMUk5exUDe0NbOtGHUMx/xluLXFrWAuNv9AvYEYjGgz/keSoNdEofoqxu2JE5SkKqRH510heOjiW9f7H1NhVzkeKrKSPer+Le32QoDuqRJCamhaE8t3cQTzoe2vuMA/3kpCqFhUCvVDpqiPVXcNzJGiEqWy/CWK+ovaiJbjo4xaAPkUtjLWt 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)(7416014)(1800799024)(376014)(36860700016)(82310400026)(22082099003)(18002099003)(56012099003)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cO3s9MOacedf6VnWGNg6Z2jciM/0XeNWnyoZKWNFD1s3QpGDnb7iXuEytZSwTPLkRQ62HpVHZC7FoTCs4d1WieDJR9TxhnTEIQpCSwmUh08lMC7vUox8JIXqK5vEqq4FeQp9sF3KLh7KlF9a3yrPsyWbJwpDOP1UYrrAOI8a2NKfEnQHV3fAf+pgqd8Q2uRrFLx1YBpT/p7Ts+OZGL1eyel+y+5l2olWeNfGLp6I30aMAoQEhlmeyAA6zTMQRRFQVzK1HK5CfWl0OBq5jj4sBiNqinjqprYVrrowr6r9CIuU0iHW/UtiUHEZALaMB+SWr8ieMRDergoQyEnU14nhn4PlPRCn5AFGY8VtIqu5oTjzPaQdltV31DHWulrjL5xwHqj52WLtRgx8eIzuAQRi8zWW71Nn8O8Zei6VAMTS8+rC7KB+MSIT4iMTkQX5W3C0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2026 07:50:04.4254 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6be765bf-2d72-4eda-722e-08dea68d1753 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: SJ1PEPF000026C3.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7263 Hello Furkan, On 4/30/2026 11:46 AM, Furkan Çalışkan wrote: > On 4/29/26 19:41, Vincent Guittot wrote: >> The assumption that p is always enqueued and not delayed, is only true for >> wakeup. If p was moved while sched_delayed, pick_next_entity will dequeue >> it during the attach and the cfs might become empty. >> >> Fixes: ac8e69e69363 ("sched/fair: Fix wakeup_preempt_fair() vs delayed dequeue") >> Signed-off-by: Vincent Guittot >> --- >> >> I have triggered this while running my latency stress test on a new platform. >> >> kernel/sched/fair.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >> index 728965851842..99fb524c4922 100644 >> --- a/kernel/sched/fair.c >> +++ b/kernel/sched/fair.c >> @@ -9147,7 +9147,7 @@ static void wakeup_preempt_fair(struct rq *rq, struct task_struct *p, int wake_f >> * Because p is enqueued, nse being null can only mean that we >> * dequeued a delayed task. >> */ >> - if (!nse) >> + if (!nse && (wake_flags & WF_TTWU)) >> goto pick; >> >> if (sched_feat(RUN_TO_PARITY)) > > When a sched_delayed task is migrated (which can only happen via > MIGRATE_LOAD per can_migrate_task()), enqueuing it on the dest cpu will > call wakeup_preempt_fair immediately, and if the dest cpu is not busy, > pick_next_entity() will likely pick and dequeue it immediately. So a > wasted enqueue+dequeue pair. Could we skip the enqueue when > sched_delayed is set, and defer it to the actual wakeup path? That requires some considerations - if we are migrating a delayed task to an idle CPU, we can readily block the delayed task if we don't have other tasks on the migration list. If the destination is busy, or if we are migrating a bunch of tasks, we need to know what the final state of the task_timeline will be to make a decision whether it is okay to block them immediately. We need to know where the avg_vruntime() and deadline ends up to know if the task will get picked immediately and we cannot do that without going through place_entity + __enqueue_entity(). There is also cgroup implication where, the delayed task might not be picked immediately if it is on a cgroup whose entity is not eligible and that requires going through the full enqueue + pick. -- Thanks and Regards, Prateek