Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.195.3 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796194206; b=j8z0gS7VvCuekZVQh3LOJQgqw0xup5ootucNYf97uK3XsL9mEaDqcPsisqDzbfrWQXLL 7nTFPZuO0F5n1yz4lbMOmabuBBVF1HXb4q17qfKm7Ir0I9tAPjI3hyPVR4s9SDzVM7iUr HXZpIkw/pAyHSuwf8T6xx9pcVuycyKHDI2ZjISV10yIiJpTj2wWn/yXoCb8BsRNakOv/K O//3E5sffVrQ2nm07lBl0HOt6rbCMiQ4JfQvLjQbWTJpvs+T9iCtitFBGXn2vIHYx/Gqp q3XHSd469QNd9opzFdSHsh6Sgs5gbbeO13D+IAu/SWFrr8nsRySiZUzCLIZO/IVXaCA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796194206; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF: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=IUbrRFOq2hq4V8dF2mt3o+5nGR8dtroWUmNGRMX+V28=; b=r8ML4135nQS/cZ66eQ5CSm58EfXZMaNw3xKJSvUGEstTzfXjlCE9814YAV9oespdj7pU iQyXjpVicI/uICWU+7Tt1sYltqitBWq1xDnybCGvOFWMKM6+UwpKAVtdoIJx6qO76onTr WtYzLdnwXYqpeGtm5UixvmxtsCZF2RLDUal5jR76xqB7puB7by1TLq5WdHB6eejD2192p XKcs8OOhp2Uhy+rDs/jQJMcV+iiDuupk80joc2w1ht+mFLwqBsTkSBkewVXnLkikgmG1m ibs5ehC7dKrGyk/Wutww2fsgsBOke5FzrQmvGyxTfuY6V1VCUENOuHbQiA1UogmjdUA== 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=VPtQZnqe; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.195.3 Received: from SN4PR2101CU001.outbound.protection.outlook.com (mail-southcentralusazon11012003.outbound.protection.outlook.com [40.93.195.3]) (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 CE210606A31A for ; Wed, 2 Dec 2026 06:50:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CE210606A31A 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=VPtQZnqe ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DY0UA23VLkwRMh35tGMtoQa1s5S46rHAXcUGitosALR08u+evTMT+zzh/h1NDReHN/CuPoDG/NGxTSNAww5U4MAWzE/z8RXw2tbzDIKiqK+uEvq3MJPJCV9itKm4xcPw32pija3YUPSXpxcZyq8VXbpFZrnF2vWpxFddSuiRDK0gXJ6MD+hXy5w97L1KAk6jvZ2W0rnnDZxvbTmKDJmVai/8umZiQCSZbd/oFJEtrOEfLQL8VYKCzHusdHi17WIGf46ztm8JRV2+88CkruwwQtD8VOomFpyvCI5sRcRmsvuM9RHaF/jHtOO85mDCCryj92mc/xwxzG3gypDSwGTuKQ== 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=IUbrRFOq2hq4V8dF2mt3o+5nGR8dtroWUmNGRMX+V28=; b=pfsRegHCPLKGM5lOrKDkW0+tkujIcvP7XjU8xx817hjk/g+r5z2mPgqxQeh9HlfqFrEdjaypy6nNkAV553CH12MyAicRcPL8dBFOxHKiguBlsbT+HfILOuy+cRjiZZsIJdi5Quc7+wxUP9p+YO/LT112vlDZMKVFwqtTmDbgoO4NcX35JujJ7hRHts+Qv4qs/Ny7DzwZ5VCdIqzJEOcrgAhQcXEFFadt7pboK8TptOqHdFIW069rtGzBAllGWYS2f1T813FG676DBeeA9KiTpBqH9bt8BosS4OjBOKHPzQMlJSdJzZ5OELQ8wxR7Vzc5Apo6Zoe12vmQZvWWE7i+4w== 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=IUbrRFOq2hq4V8dF2mt3o+5nGR8dtroWUmNGRMX+V28=; b=VPtQZnqeezsV31gwbfTObn/sRGe6sUxjEnbKXA07A5qxDDxSgARmIpH6v62wU1rzKhC/PA8JdMU6nszeV0d4vuRmJg5hxKV/Mtpk+PqByJ4QTw8NBhIrKnLh39rIN0Cb5r+kPZjWeV6SmaSrZwtSQ5NAmmsKUOexwUolsO8fMbI= Received: from BY3PR05CA0035.namprd05.prod.outlook.com (2603:10b6:a03:39b::10) by DM4PR12MB5961.namprd12.prod.outlook.com (2603:10b6:8:68::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.13; Wed, 2 Dec 2026 06:50:01 +0000 Received: from SJ1PEPF00002323.namprd03.prod.outlook.com (2603:10b6:a03:39b:cafe::5d) by BY3PR05CA0035.outlook.office365.com (2603:10b6:a03:39b::10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.709.5 via Frontend Transport; Wed, 2 Dec 2026 06:50:01 +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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by SJ1PEPF00002323.mail.protection.outlook.com (10.167.242.85) 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 06:50:01 +0000 Received: from satlexmb07.amd.com (10.181.42.216) 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.57; Wed, 2 Dec 2026 00:49:51 -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; Wed, 2 Dec 2026 00:49:43 -0600 Message-ID: Date: Wed, 2 Dec 2026 12:19:42 +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 CC: LKML , 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> <03af50f0-fa65-4abb-8053-79b65318ebd8@amd.com> Content-Language: en-US From: K Prateek Nayak In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002323:EE_|DM4PR12MB5961:EE_ X-MS-Office365-Filtering-Correlation-Id: f1d49b23-39b5-42ba-8058-08df50407d03 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|36860700016|1800799024|82310400026|376014|7416014|18002099003|22082099003|10067099003|56012099006|261102123227099003|261028144727099003|261021135927099003|261021121427099003|261026121527099003|261026140227099003|261022105027099003|11063799006|4143699003; X-Microsoft-Antispam-Message-Info: mipeEbsTXn9xwTcLmde+V9e3NQTNhymnEd3Llj+n45WokJ5Hl2DQYA/nmkf3xEwDKSBUmQ9UGnHgEn9fyOY/BV3+sWcCPQ3By99H2dwxzVyrMcGL0g59S/xd3rKcD7hVZXFs+dtG1+GzkjYh01PJu7dUysHyMUWqqBqk62t0IGtkygnpYCjui8/kV3h7lpsLyY1bux86jqc6NboG9osLKOCZnf85KVj+/8UkDWRZUE9v0W86LXXv5cs1sYNEKsG9jU/s9/cYz6ck5qRy7CaUjl/D0PERqwO0CE1r/O9A+fowEASq9/KkmWFgRomWcw6kXOtxo20cXF6SOibDK+xVdm/3hSnxRJ8V0svGULhaxg288WqKJFtljBxh1hbAGlvN8cMDj5yi6fKx7KQ2Uv70IfCQqR+GO1CwxLV3lZaYEfTT3pBzN0JpkjF2oHyl5f7ELBOAFm5qQ2Q0f8ZtIPYqzMvZQ0bYoa53v9oUX/ENiTQbHGIdEF0hTODLNCthMaY3isZTRLiF8jHvtwNG0sbvDaHD6TGwiYtOPUqcNHf+mWgrxFVag22KwouQriCmGblnh0ADHoQR640R1aISTjmljbcV++t2gAhpwxYO3enuzsGgPweTuu40kWnjMDBxqpjyzxZ5YfZg/GDRE7B4moKIY2+ZvI6t6mi9gJbS6W6uii3qWVUMv7kaRheNMFYb924fwXdjLWES5ZwupdjT9CIyIg== 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)(23010399003)(36860700016)(1800799024)(82310400026)(376014)(7416014)(18002099003)(22082099003)(10067099003)(56012099006)(261102123227099003)(261028144727099003)(261021135927099003)(261021121427099003)(261026121527099003)(261026140227099003)(261022105027099003)(11063799006)(4143699003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iTcR9kIdHuN3qoxLe8KY0Z8mu65dWEXZe/Cz42OHIUJrefqk7BQAc+b+OXi8Kop9jybVPXmeIuSdKVVJFtfelITE6wlEbUsn5YaBL3LHJLr6RjGheBv2hbKGOILdafo/sDyXcZs8P9u7Ly7PaFriG8pG9DTRVLpkSv7rQaA4Hysp+yxzi6ZbaEQx2Qe2SMSGEPQYPinB70VWcmZgQGnibL1jhLJVdEezqVT/UDeIT3LuW4/5gVogoh31wqwP6oL3VCKr9KfDzIVkmekw7T/hnZOtHjohnNeC51pF9VuKua/F8HSSAXhM1CCHqI5s+eD6p1JPq4vZeEs2MbPBlIjBvlemFyMVlJQv5XPw69GMqAfRvMc08rwBF8CHoGoq3TrOAHF3wY84BYfnDAo8jRoFDRnIXePoTPZh7vPgus5sXWA6YPanm2nwYtUGic+ho10I X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2026 06:50:01.4171 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f1d49b23-39b5-42ba-8058-08df50407d03 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: SJ1PEPF00002323.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5961 Hello John, On 12/2/2026 12:02 PM, John Stultz wrote: >>> So just that I'm understanding you properly, the idea is just to >>> rework the logic currently done under the blocked_lock, so after the >>> patches in this series, proxy_needs_return() would look like: >>> >>> { >>> proxy_clear_curr_donor(rq, p); >>> if (rq->donor != rq->curr) >>> resched_curr(rq); >>> >>> if (task_current(rq, p)) >>> return false; >>> >>> if (task_cpu(p) == p->wake_cpu && !rt_or_dl_task(p)) >>> return false; >>> >>> if (task_current_donor(rq, p)) >>> proxy_reset_donor(rq); >>> >>> clear_task_blocked_on(p, NULL); >>> block_task(rq, p, TASK_WAKING, 0); >>> } >>> >>> ? >> >> Almost! what I thought looks like: >> >> { >> if (task_current(rq, p)) >> return false; >> >> if (task_current_donor(rq, p)) >> proxy_reset_donor(rq); /* Do proxy_clear_curr_donor() within */ > > I don't think that would work. If there'a a chain A->B->C where A is > the donor, and C is curr. If B wakes up, we need to do the > proxy_clear_curr_donor() (since its C's->blocked_donor). > > If we hide that under a task_current_donor() conditional, we'll only > call it if p==A. > > Also, your example skipped the: > if (rq->donor != rq->curr) > resched_curr(rq); > > bit which is what the patch at the start of this thread is focused on. Ah! I see. So any part of chain currently proxying should call a resched and it is not trivial to detect that chain from that one wakeup without some from of traversal. I completely missed that. Thank you for patiently explaining the problem! >> if (task_cpu(p) == p->wake_cpu && !rt_or_dl_task(p)) >> return false; >> >> clear_task_blocked_on(p, NULL); >> block_task(rq, p, TASK_WAKING, 0); >> } >> >>> I'll give that a shot here. >>> >>> I'm wondering if a if (!sched_proxy_exec()) return; shortcut at the >>> top might be nice too since we may not want to trip up the rt/dl task >>> case and do all the work, but I know Peter wasn't happy with that >>> being sprinkled around. >> >> Ack! That makes sense given the rt_or_dl_task() condition. > > I'll add that in as well then. The reordering/reworking the logic > feels separate enough I'll do it in a separate patch from the original > change here from Mathieu. > > thanks > -john -- Thanks and Regards, Prateek