Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.196.31 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796187642; b=R5t37qi7RJdItcGx9LXIcqHZqAGdMathS7sPfrdmetKbRkRq6Omr9sS4wsMkWbvXzwFL Dfxqnp12eefvICojaZyFcjnpM71mc62sb0IB5a5jHao2RyAz9N4vcFWW2rtPSEVUiOAGC 4S0atF/xxuNZ8qH3OBOSq5oSE6y2FG90XXfiBEXHfpBnN+6lfmsZG4a4/bEHBWtmTl0FE w0IypFftSmXgoYpeAWvETKG20tkXAoJeoUmICffyILk/2ExrZBB4kcNxemkblSQ2TPvDD swtxCyoRbZCcouotZCeOq7B0upnJP+IfXJbQxOahdb/68S5+kXzkOpqn97ELMUD2+Uw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796187642; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: Received:Received:Message-ID:Date:MIME-Version:User-Agent:Subject:To: CC:References:Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-EOPAttributedMessage: X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=uXYUabZ9k/XKdGi+zuHELcPd7CuQh93x9phFF3U2Q9M=; b=f8q4KyJIQx8+jJ/8v/OS4LvmmJ03rphSgbCfdtadRrIcj4wJOHzmfZE6YNKR+RiGkP0K RBVccvbQqsgVlm1cirRx3yAcUuIeSscKGCMOS5hMYWxP00mkpIPL0TzqIVLA/BHfSrQMq OwdE+h+v3HwL4Yfp7Xs66gDxAPby/QyADLDAtnQUm2UJzcDUpYIvaqyJazALLTLvbLfGA IF7RpU5q32nPvsPR33tsupJ3AriOZ3ggUPjxh3Mf6FNDjYLRHiGuQNBBIq1u8Hktaw6Ma fTCyCm9xZfc5F3ju0sYzoGDQayUfb/t82NGwhcPl8QeGioV3gQBSjtJM/K5kgcPRA9g== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=egNq52kN; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.196.31 Received: from SA9PR02CU001.outbound.protection.outlook.com (mail-southcentralusazon11013031.outbound.protection.outlook.com [40.93.196.31]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A04AB606A31A for ; Wed, 2 Dec 2026 05:00:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A04AB606A31A 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, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=egNq52kN ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=o27GFDG2xgvg1Ogj5HzziMlj+ireyyDq+DgoocuhxGw6lW+KR1cvZyzTYXQdhW1edUT5ajqOvfWyrOaRDsWfuiq1vcAPGRezYlwTNED7W7uo/S7n7Yr9/9FfbOoku8Cytmc5XQL6WEXlEQjM/wNk7BzSZZr6E43HdP54qCLdTF40C6X4Flp4N1ZwwLekq0DPN/ubYSFNBCNj0xf3piBLmBIuWAAEgakTfctANQR3mABI+g+D/cEmiQoQ1qKTyywF3cMt6Kk/DwslXdzkOQpFcbKRiWcSoGmp7KyJo/1Er9x4ZWN0AGi/Vm79e7Vug7fsvOEw3K6vZXEgouF2AeM08g== 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=uXYUabZ9k/XKdGi+zuHELcPd7CuQh93x9phFF3U2Q9M=; b=ZeT5DE7bNWiDUEM4NfiOAsRUwoOBUeIAsjuGsvG+AIkq06Y9uLau6X188YqEZPQnaCU9NzPk2t3mJHuYOP1cJw4gInr7wuhLxRrdfs/clL5r1iZBIs2JbQCEi3YxJv5XDRHhRQUoYNHTtkFrszC73Ky3wuhB0u/BExYtkuBKUiiwzYTs1YlzBsMuFJXGdF9RYXGWUNMABJqw4uLOEL0trjHqkh+YXO7/fd8pKFqrXsE1BSDRRUwLiXHI+lE8L8ZB8dfjBYwjlpR37aoheFLyyj4RcuEAa7OYBSvXEtDFgTLqEpfv8rYne/S608rfwztNrN1o/n8hkkPDfDMqD9cWqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=google.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=uXYUabZ9k/XKdGi+zuHELcPd7CuQh93x9phFF3U2Q9M=; b=egNq52kN8bF69OIZQ48LP/WOXpn8xU9bqBt7vf/KrPmnyFF8H9Wo4P5BOYZ1s9UI+DrcyWIGOlEhFXvyotBMij8Lgq4yDcy6ocKawCMQxCatUSfHz2LcI7mJk1pos2V7JBwa3BUUJQEvXCn+cWAPclpfvDbt5tnmao8+kGLgPNA= Received: from PH7PR17CA0066.namprd17.prod.outlook.com (2603:10b6:510:325::15) by DM6PR12MB4265.namprd12.prod.outlook.com (2603:10b6:5:211::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Wed, 2 Dec 2026 05:00:36 +0000 Received: from PH2PEPF00048916.namprd05.prod.outlook.com (2603:10b6:510:325:cafe::7f) by PH7PR17CA0066.outlook.office365.com (2603:10b6:510:325::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.10 via Frontend Transport; Wed, 2 Dec 2026 05:00:36 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; 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 PH2PEPF00048916.mail.protection.outlook.com (10.167.243.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.5 via Frontend Transport; Wed, 2 Dec 2026 05:00:35 +0000 Received: from Satlexmb09.amd.com (10.181.42.218) 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.57; Tue, 1 Dec 2026 23:00:35 -0600 Received: from satlexmb07.amd.com (10.181.42.216) by satlexmb09.amd.com (10.181.42.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Tue, 1 Dec 2026 23:00:34 -0600 Received: from [10.136.42.27] (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.57 via Frontend Transport; Tue, 1 Dec 2026 23:00:27 -0600 Message-ID: <03af50f0-fa65-4abb-8053-79b65318ebd8@amd.com> Date: Wed, 2 Dec 2026 10:30:26 +0530 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v34 03/14] sched/proxy: Reschedule when a blocked task is woken under a proxy To: John Stultz , LKML CC: Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Juri Lelli , Vincent Guittot , Valentin Schneider , Suleiman Souhlal , Andrea Righi , Johannes Weiner , Metin Kaya , Dietmar Eggemann , Steven Rostedt , Zimuzo Ezeozue , Waiman Long , Boqun Feng , "Paul E. McKenney" , Joel Fernandes , Qais Yousef , Xuewen Yan , kuyo chang , hupu , Zhan Xusheng , "zhidao su (Xiaomi)" , Hui Su , "Shubhang Kaushik (Ampere)" , References: <20261202035248.1210026-1-jstultz@google.com> <20261202035248.1210026-4-jstultz@google.com> Content-Language: en-US From: K Prateek Nayak In-Reply-To: <20261202035248.1210026-4-jstultz@google.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH2PEPF00048916:EE_|DM6PR12MB4265:EE_ X-MS-Office365-Filtering-Correlation-Id: 89590968-7b96-429b-ff7b-08df50313393 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700016|7416014|1800799024|23010399003|82310400026|10067099003|56012099006|261022075727099003|261021135927099003|261026121527099003|261021123027099003|261022105027099003|261026140227099003|261028144727099003|11063799006|22082099003|18002099003|4143699003; X-Microsoft-Antispam-Message-Info: uqqW8lN7Np1aAtPUCEZ86a0/yMnwwJ72VJd++oTR54EXtpk4xJvSuMCrP2WIoIGim1jTDBVVRHnc6GZ0MMfZq+Aqlllx/LPLqchd0WQGVbbJ+TsqxBLpvSLZDyKqZhFTGp3cWNxZvNezrG3pcgC1wRH+BIKyNRe58Wt+aFXgOI5juSDp3exBcQoxOGHRgvjRjWANPFZbcHXHVqRoE5sJhrHdC4k9NGVlP7MZOK+NLlNcmuPGeBSVqjRq8qgehPEHbOUPVo9D86eNGRZ/GMe+Vl2QOutlMPZh30bird6WNB2Wq6Bjt8Z4zQ/B9OgzIOPAA0VM2bZRS/KPrbd6dTLmDoC8y4KsElINjXOYMTVf01mjxNWvVtkhc8Jb7+U/S9pXk1D55VkWcmoGzhbokCzKNJv01ypeQfmJKquNPMcfgtvt3iuuI0XxH7DSL/1ucGyCa5SznxADidMIBfzqXvsX01tXH+MbEpUi8KoSz7A+3phzFaofuC/HUkbs5SlH2J4nxCWtJL/DH8cZd9qpv/H5nkyMkQdftnhgyi07ZBWTWSgGKyuqenh4V94oMY547zNQp2AM/41kT2KK4isv+y4MYgphZnuOboUW0UCSjZQ6y55rzZzHXiOsYodKINRLgkC+y6dlrgtbV9NY6dStQSf4gYtGHRaUXr8mlvGweBYVpsmrh3FbV9wLTLQVz41dvR2yQgn/dzKlEMx5zJin6MiXzQ== 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)(376014)(36860700016)(7416014)(1800799024)(23010399003)(82310400026)(10067099003)(56012099006)(261022075727099003)(261021135927099003)(261026121527099003)(261021123027099003)(261022105027099003)(261026140227099003)(261028144727099003)(11063799006)(22082099003)(18002099003)(4143699003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mdKpK5nVDjrbXL6kojvyTJeIR2VBrDLkzds/HPitCiR3zAn4HVjKqUq4BuACvMTFGQ1amMyE+BP0YfeIlKtK0V73V/tsjsCpHAbIVLdHW1OOTx9ZuKi13W7qRHKPlKmh4ra60/FQbgaNAF1zcoucjv6frmhlVlVlj/ZDnkdq9jIsVdvIByxaGRmwPOvVdeogrRaQ6eg/zIPu8iBjOWjmlDd1BTGZgfoZwOLP7HCq9x4dRxy3Sjdl89uBx0c7XrGuJq33GoVwebjU1P8PprcY0T/Ci3V4adSMEV3Kyc6LS8lFx+S2M2sxffpyvV0BMXrkau/w10qdx5NGRAVwG9Xy85+3LvP5Yzk66VEyC4lR4bhb5IJLJ9vQkWSqaEYKlbMRga1XULBgFJmUEdn1nvdqN47U9n6sumX7KOuFuF2rsowsok+bSN6SEItn2lhp6+NL X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2026 05:00:35.7727 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 89590968-7b96-429b-ff7b-08df50313393 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: PH2PEPF00048916.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4265 Hello John, On 12/2/2026 9:22 AM, John Stultz wrote: > From: Mathieu Desnoyers > > With proxy execution, a task blocked on a mutex stays on its runqueue. > The scheduler can pick it as the donor and run the mutex owner in its > place. When the donor is woken, the CPU must stop running the owner on > the donor's context. > > Commit 7918cf369361 ("sched/proxy: Only return migrate when needed") > wakes a blocked task in place when it is still on its original CPU. > ttwu_runnable() then relies on wakeup_preempt() to preempt the running > task. But every class compares the woken task with rq->donor. When the > woken task is the donor, it compares the task with itself, and no > reschedule is requested. Only sched_ext handles this, with WF_TTWU_RQ. Question: proxy_needs_return() needed to grab the &p->blocked_lock to clear the p->blocked_on relationship previously but now that we have the p->is_blocked state, we probably don't have to touch p->blocked_on at all - a successful lock acquisition will clear it on the way out of mutex_lock_common(). We can perhaps re-arrange the checks in proxy_needs_return() as: if (task_current(rq, p)) /* implies p->on_cpu && task_cpu(p) == p->wake_cpu */ return false; if (task_current_donor(rq, p) proxy_reset_donor(rq) if (task_cpu(p) == p->wake_cpu && !rt_dl_task(p)) return false; /* Do the dequeue; Don't touch p->blocked_on. */ That should automatically allow ttwu_runnable() calling wakeup_preempt() to do the right thing and since p->blocked_on is only used to traverse chain if p->is_blocked is true first, there should be no harm to retain that. One of the fist thing that is done when the task runs on CPU is to re-establish that blocked_on relation which doesn't change now. Is there any harm in retaining it? > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 181d0e70c88d4..9ba25925c928a 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -3981,6 +3981,14 @@ static int ttwu_runnable(struct task_struct *p, int wake_flags) > if (p->is_blocked) { > if (p->se.sched_delayed) > enqueue_task(rq, p, ENQUEUE_NOCLOCK | ENQUEUE_DELAYED); > + /* > + * If we're waking a blocked task and we are > + * currently proxying, force a resched in case > + * the woken task p is in the current donor chain > + */ > + if (rq->donor != rq->curr) > + resched_curr(rq); > + Principally, I don't have problem with this approach but being able to keep all the proxy related handling contained in proxy_needs_return() below would be nice :-) > if (proxy_needs_return(rq, p)) > return 0; > } -- Thanks and Regards, Prateek