From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from PH0PR06CU001.outbound.protection.outlook.com (mail-westus3azon11011054.outbound.protection.outlook.com [40.107.208.54]) (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 F27854A07 for ; Thu, 20 Nov 2025 03:16:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.208.54 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763608581; cv=fail; b=erBtf/SVIvMHStlY2oEIDzH2JWqwSn0WsrWSHHEVTZW6gWNNVAd7oSW1V9apyAdO5cCVlj09VZw21hNNbyBrTOXJRIY+Uxbkc2QwyuO//s8VY5SlA8FZ76fULmeuDiJ9YZLUjdrr1PNiPmHLuaefjNi9MujVEOQDgSBxF7iawk8= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763608581; c=relaxed/simple; bh=4GfEajbqBKNpTWl6UK1cRt8ez55L759UltNV52QJbag=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=cYo59/Ah2eKG4ANJ3i55hhIZ/80JdrctcbxQSV6gDkqF2Y8b9xWFBuJQxpyp8Rdu+iMwgvQgRaUUElSSh8f0ZwQT0w1nB3HcDtt+wZPrBsVEhE3/G/8JpoGawlYRRBuaEhhdQdL4G7j7v3LFkRP8e3U5zsIiyd1av/qC5NNw7Ks= 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=RU0H8MM6; arc=fail smtp.client-ip=40.107.208.54 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="RU0H8MM6" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AokU/mE0Rgr8ssRda/lBsUh+/e6hKtJ1QMd7PkciH6AX32Nom5mNhCAJb1lwxJXdjeXxkd92vmSBZoB1QF9229BkS6eTXjRIatfPRxylhjAko+c8FamzUIcH4hvl40sfQirUCEsixhSVzQ6tpSCw4ixdnO1XPBR+d4ZmVPinoYBQcA+qVCqH+biqXB7Z9lS6oFRTBlGXdWLwy5vufsSatzUN9S+pyDvm3w4q2JHc24LynuiwiTlJ90ITyTiY5T7Fzehb2VSQCnu11FSfngL4vQNQTGMH4uCznYZeofjkWbDl2vtmpy8XShUECC3QRP1C58fdI3BeEtwHaLYJFGs23A== 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=dnNIpt1bhSbttLuwNJKRPGlMaOL5Ismw111/HumjI0A=; b=LHqwFWvij3+04OTgIsPkxT0kuNDnU4nkuvJvaEy8mpxYuRBCUIxN5JnFshL9uGTOciGsuGb7Sptmo/sEBJfAoAAPVp8ScE3/BXFIOxlITgWvue0ZqJQExisviMi4ads71V9MbG7IL+4iUw5cSoTve+WqV8q2eVpxXnHZ3SvsPwGta92TZ8IYNjxm9aT08jjpEl/SgfyGnSqmdR3K/9ZQUr2gqI0wJxY845uAXAhUWf6YpmHRm6BWgzMuxxeZZ+AxsVcursPIDyBW47zQDLL/ijTTPXgskjQXXhbG97/ri+KXDASdfjVwEbVai57YixIvxXjBg3IT9HcVhTmf+BRdkA== 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=dnNIpt1bhSbttLuwNJKRPGlMaOL5Ismw111/HumjI0A=; b=RU0H8MM6dAq4TZgwWV4iLQmDTR/HVA0mIJI4+ti9+YjBg6jCYBPIOSXSDpIcI8iLCSOKrHnVIQqO0Gn1/1/t19+tgtyqtR6JNOHIK4xuO1dT+cumLvNrYmB6pFHUDFZ1xi7SPQDq/JvHIHuAJqeP8lMSNegFHx0eTAA0uIS/G8Y= Received: from SJ0PR03CA0334.namprd03.prod.outlook.com (2603:10b6:a03:39c::9) by DS7PR12MB6216.namprd12.prod.outlook.com (2603:10b6:8:94::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9343.10; Thu, 20 Nov 2025 03:16:15 +0000 Received: from SJ5PEPF000001F1.namprd05.prod.outlook.com (2603:10b6:a03:39c:cafe::92) by SJ0PR03CA0334.outlook.office365.com (2603:10b6:a03:39c::9) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9343.10 via Frontend Transport; Thu, 20 Nov 2025 03:16:14 +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 SJ5PEPF000001F1.mail.protection.outlook.com (10.167.242.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9343.9 via Frontend Transport; Thu, 20 Nov 2025 03:16:15 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.17; Wed, 19 Nov 2025 19:16:01 -0800 Received: from satlexmb07.amd.com (10.181.42.216) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 19 Nov 2025 21:16:01 -0600 Received: from [10.136.37.179] (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.17 via Frontend Transport; Wed, 19 Nov 2025 19:15:55 -0800 Message-ID: Date: Thu, 20 Nov 2025 08:45:54 +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 v23 7/9] sched: Have try_to_wake_up() handle return-migration for PROXY_WAKING case To: John Stultz CC: LKML , Joel Fernandes , Qais Yousef , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Valentin Schneider , Steven Rostedt , Ben Segall , Zimuzo Ezeozue , Mel Gorman , Will Deacon , Waiman Long , Boqun Feng , "Paul E. McKenney" , Metin Kaya , Xuewen Yan , Thomas Gleixner , "Daniel Lezcano" , Suleiman Souhlal , kuyo chang , hupu , References: <20251030001857.681432-1-jstultz@google.com> <20251030001857.681432-8-jstultz@google.com> <65135fff-f347-4d31-b980-9dd5488fa094@amd.com> Content-Language: en-US From: K Prateek Nayak In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Received-SPF: None (SATLEXMB05.amd.com: kprateek.nayak@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001F1:EE_|DS7PR12MB6216:EE_ X-MS-Office365-Filtering-Correlation-Id: 46027231-9832-4e47-138e-08de27e32a29 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?B?eEZlSTlmdy9XaHNoSUlZd3JmWHJjTTRTdlUzT2RSQnp2NkE4MXBSNWh4eHYy?= =?utf-8?B?RTFUZzhRZzBjY0NuQWc3c0RaN1JTK2wvdWNvenEzQ3Nnc1hkdlNyeVRkQ1li?= =?utf-8?B?RnBrS1U3T21UaG94OFlWMTVIS1pGdW92cXRqTTBFRkFENkR4SElRTmcyNTl4?= =?utf-8?B?dU9XNGNyb0NFTTl1UHhoc2VWUHZsMmxvN2FqTysraUVtZnlTeEZ0MnU3anpR?= =?utf-8?B?a1lpYjNDWVlTMVZlaDZFdWtQdmcvczU5RXN2VEM3N0NBeUovVXRIVzJ0VEI0?= =?utf-8?B?cnhBeUJKQURiNFlzK0l1M2FVWStFdS8wT0tBVDBvOUR0VTNpOFpBMmVMVG5u?= =?utf-8?B?bSsyQWpzaCtuVlRTTThTRkV3WG9uckN4SWZLQWNTWTVvQ3AzRzF6WlhxY3hR?= =?utf-8?B?WU1WaU9ZTTlUN2lQcVd3d1c3VlhIYXJOeUhwbEY2ZEdJYVE0Qks3TjloMjc2?= =?utf-8?B?UDEvcjRIQlVRWXVnNDdJclZsTTZNMkhxOG1VNC9LemRBREc3Sm10UkQ4MDFp?= =?utf-8?B?bkFmU29xVUhvTmRHUmZTczJGOWl4TTBoSXRuVkEzdEVkUjI3MkVyNzdpQS9u?= =?utf-8?B?bitjVit5anBORjVjam5GOU5waUhJdzFwcVNXT2NTV1JZWC9Lc25sVFVPdmly?= =?utf-8?B?S2kyVVZxRnd6R1pDL1VvMFB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q5VDJOV3UrbFA1ZFhJRjF5RytzVWk5WE9aNURZQTQzck1RaGozVjlD?= =?utf-8?B?TFJoWHY1VHFmeWVuMm80UnoweGpNTGFtMVJJVWQzR2ZoUEl3ek9WL3Z5bHJG?= =?utf-8?B?ejdzNjczNWFGYVNHZE5UdERZYzRrR3NZTlE2MGRZcmFPM2czV2VtMHRHYkxE?= =?utf-8?B?RHYwZFJFa2g1azNOVUVDV3E2bHdrNEZyWVBvTjZwaXFKclNCQVg0TitGaWRW?= =?utf-8?B?REhydTgvS2ZFTEgzMzNKQThZRFprWTNFNGRKSUt3V2RmNjlZM0h1WmVsME50?= =?utf-8?B?a1RoazY1WS9HN01UTmoxaWtNczBKRW1WQ09UMWtyNjY5RTlRRXpWVXoyRGxW?= =?utf-8?B?NXRWUEp3ajk3WXp3cWRxcW5tQituV1JkOGRCMG1xWGZ4a0poazZwb3NOY3h4?= =?utf-8?B?WlN6STE0KzFqMnJWTStaSFJheGFOS25vd3RybXZKVDBPWjUzQ05iOG4xdnVT?= =?utf-8?B?MXZqSnhkalJKdHlORUJRdFVBRG9mY1ZYLytDcTQzR1k3bnNHMHd1QUdFWTNB?= =?utf-8?Q?b7Fs=3D?= 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)(376014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2025 03:16:15.0849 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 46027231-9832-4e47-138e-08de27e32a29 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: SJ5PEPF000001F1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6216 Hello John, On 11/20/2025 6:35 AM, John Stultz wrote: >> Sounds like block_task() would be better than deactivate_task() above >> in that case. Anything that is waiting on the task's state change takes >> the pi_lock afaik and the wakeup is always done with pi_lock held so >> blocking the task shouldn't cause any problems based on my reading. > > So earlier I did try using block_task() but it always seemed to run > into crashes, which I assumed was because other cpus were picking the > task up as it wasn't on_rq (any references to a task after > block_task() in other situations often runs into this trouble). > > But your point about the pi_lock being held is a good one, so I will > tinker and think a bit more on this. So if you hadn't used DEQUEUE_SPECIAL previously with block_task(), there is a case where: > @@ -3784,6 +3834,8 @@ static int ttwu_runnable(struct task_struct *p, int wake_flags) > update_rq_clock(rq); > if (p->se.sched_delayed) > enqueue_task(rq, p, ENQUEUE_NOCLOCK | ENQUEUE_DELAYED); > + if (proxy_needs_return(rq, p)) > + goto out; Task turns delayed here but the delayed condition is handled before proxy_needs_return(). Perhaps you can try reordering them? Since we avoid calling block_task() on blocked donors, I don't think they can be delayed until we actually call block_task(). I might be missing other subtleties but this is one case I could think of. > if (!task_on_cpu(rq, p)) { > /* > * When on_rq && !on_cpu the task is preempted, see if -- Thanks and Regards, Prateek