From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from CY7PR03CU001.outbound.protection.outlook.com (mail-westcentralusazon11010002.outbound.protection.outlook.com [40.93.198.2]) (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 B3AB3372AAA for ; Thu, 20 Nov 2025 07:16:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.198.2 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763623011; cv=fail; b=aRxj3VCZhIb1qS7h4OenllwkChDaAOprGqCcrbyzZJGGQjv/TSPPFQmFWSPD08JMg3WkesO5GK4KcU3FWh2E/ARoJpfbkydyAXlLIng6OVDkDxgrMU1i0r0Ie/ux7vfCIC3yRcmdHf8T3m5s92JST/DLtdwdwWkmAxi2gCV2vHs= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763623011; c=relaxed/simple; bh=XfgXY6OXB3AzunHf+oTKN51wzM61qXHudqNMjgUiwrg=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=WzS++6F0FxMZ5Oanhm8y7CIayk9ftJijFeV++DRiXettxsLjxhB3XiJDNcmB9y7J946tkUQMdgKAfNgFw7uXHLqmQW93pqHYhN/LZrKtcJqjsdJfNDrZdEEOj507hPTjk1EQ2zcgasdV6FrPtPJfvTOPtlQWhoSOQEEPeKaSiR8= 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=ci6bo9+q; arc=fail smtp.client-ip=40.93.198.2 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="ci6bo9+q" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WsYNdEHNCB9wGzdB6D4cNsSRKko0Ld/5oNXoQvlRDjyaS9S4qkpkaLHrNNVFCXKzBk5BnP/hL3/2WoVIyK8nSDh7/84vkWd03QEWmd7jSiQ6fzydSgu7y6kCPRar/UiNSjIfRMlGNvxoP964hKKiCMJa6mAXeVoMJIT4ElWPiAIehgJFbJM7uoqET8dPlVpjVz3ZpF5A00rUfOeM+wN5wIj+t/WMi/tKHAJFugDPkkgyPugBCdiR8saBtHGbd9Hn5as176x4+8S8vGvwgFxGVgcyVmNJ+v7Cts0mkAfeGWr8OnKbtWcpIYt+5UTy6ylde/HG5u+6Q30GdH/d6FzgAA== 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=wA99Qq2xIr4UeeVwPRhtxRq789248+QON9GbbLgEcL8=; b=jEhDxuBuD4TAY64GL4inGe4Rcw5Ih1ENxt4zhkWAi5VxQP3p4CuBLYCOaN+Nr2a4ecTeYsqEaICMq7OkgPn1//Sx/lpzV16nbcUGFJu3ReqYtDxJJ5e9Ks+J9LunnQZxwTa+cryHca5p0MX33bhmDyCMJFuhhMXC6fJfzbsnNUFfrDDv3y35bsDFnJSDu+2/MBsdUMnIbtuWp+ur1IZnpJ9M4PcESzcoazdkiFbRZUZueCGP+D5g/uAaiPfCHNwCPKzqGK2lNm1BiRx3QUOgiPTpXLONU53E/vRYdSXLcQhRXVAZNYLnq9P2I3Qr8L5PBmtnbVsY7cXqr2pINEOdzw== 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=wA99Qq2xIr4UeeVwPRhtxRq789248+QON9GbbLgEcL8=; b=ci6bo9+qEg3GCCFPp2vWVkPpmAXKO6p6BhjYOUitqpLnlNK9AII26XXPxldzvf0mn7nFImrpePg40whCnjMGbs843smgz9vsjFirKiS2MGSzqHVD2ynkJAo3CpYfAnZeW8i+8pyZDqc+M5GTmWPOSTgYccYFBlIDhDnFT5PK/1U= Received: from MN2PR12CA0015.namprd12.prod.outlook.com (2603:10b6:208:a8::28) by SN7PR12MB8058.namprd12.prod.outlook.com (2603:10b6:806:348::14) 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 07:16:45 +0000 Received: from BL6PEPF0002256E.namprd02.prod.outlook.com (2603:10b6:208:a8:cafe::57) by MN2PR12CA0015.outlook.office365.com (2603:10b6:208:a8::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9343.11 via Frontend Transport; Thu, 20 Nov 2025 07:16:45 +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 BL6PEPF0002256E.mail.protection.outlook.com (10.167.249.36) 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 07:16:45 +0000 Received: from satlexmb10.amd.com (10.181.42.219) 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.17; Wed, 19 Nov 2025 23:16:23 -0800 Received: from satlexmb07.amd.com (10.181.42.216) 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.17; Wed, 19 Nov 2025 23:16:22 -0800 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 23:16:16 -0800 Message-ID: Date: Thu, 20 Nov 2025 12:46: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 v23 6/9] sched: Handle blocked-waiter migration (and return migration) 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-7-jstultz@google.com> <0c337bca-4ecf-4654-9256-df766573c7de@amd.com> <9de6fd90-441c-4ddd-9f79-754bf240a3ab@amd.com> Content-Language: en-US From: K Prateek Nayak In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0002256E:EE_|SN7PR12MB8058:EE_ X-MS-Office365-Filtering-Correlation-Id: 96d4a9ba-42d2-452c-04f9-08de2804c313 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|30052699003|1800799024|82310400026|376014|7416014|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?B?RjFzeE5rR3JjaDlHQVkxMndCZjYxV2xmTTBCbmRCRTdKS3haRkJIc2M0RjdW?= =?utf-8?B?dzZSeFExbmJ4Ukw5OU12M2hjdGs1M0lnV2NBR3l2WTJYSnlnaTBCRkNsTkRZ?= =?utf-8?B?UFlrZjRPTXFRMmJ3b3VjdC9zTm9mRFR1TDVjS0hVQmw5eUM1eVYzTWVFSzcz?= =?utf-8?B?VmI1Z3h1S0EwQkwyUlRwcExQUnlPUXM3ZGptd0VobUVndjFJNnlBeFBZNXdh?= =?utf-8?B?VUVuWEdqUk5XNWR3ZUhVM0cyTXVtaGpIU0ZBQUFoYWZzaVdkQTZtUnBpTUJ3?= =?utf-8?B?UVJHckVaNnlrV0FPUlJ6ZndOUVlZZndZbkx0VDNMcWZVRnNzU1FkR1E1VE4x?= =?utf-8?B?ZHBGNXJyaHZnTS93MVgrVnozeUJNcWMramJHMFEvcGxXRGVHa2hMc1E3c1Y3?= =?utf-8?B?VXIwRUlENG1mSXpiTzlmdVpNdFdRSVB1RnhHeXpzQzZXZ1phY0g5czVYK0Fs?= =?utf-8?B?bXUwTFIwVE5mbEp2QVhhQSt1ZHpWSjUwSUIrRUlkbFdNRUNRWS84SFRxbkwv?= =?utf-8?B?bCtKcGc1RFpRRUN4TU92eWNUai9jUmRPbWR3bjB2SExsZjl4RkVXK1ZsM1dr?= =?utf-8?B?Rm5NQ3V4THpWMFNrcGhXbllqbDZHNXhxR2NZRXR5QjVIQVpIRlhWOTRlbklG?= =?utf-8?B?ZVZaSzdwTS9DaGpTbXphWlU4WEpVdmd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Q2NMNE9YdzFoL0hSSFMwRjJ6SEZRTmF3?= =?utf-8?B?R1VWSWh1cDg4QW5ZY3BoS2dqWUlPVW9aR3dZSVJkbnFsWWFNYllJMmdqMkNL?= =?utf-8?B?VTYyUC81Sm1hUEhTL0JnWXlueVR4dE9SVDNxSGJaSUhXSXYvT3pxZWVhT0Jw?= =?utf-8?B?cGsrT2xveERRdE5ZVGJkTzJ3K0NPZDZJcEY5OVJVYmJIWE9pODVUNmNQRThD?= =?utf-8?B?Q2x2SE80SFlwY0lwNjNUVVl4MEZHWUhIOWhpaWRKYkNyTG1Xc3JxL3RSalFa?= =?utf-8?B?YXRLQVBrYWJQZUsyVUZSL2p5MHRENnFiOE5MQVRzdVMrTnI2QjJIdytOMm5V?= =?utf-8?B?RCtHblJZTEtaWnBDa2xEV0Q2UktEa0lUb21rOTBISmtuNmU3Nk1NZ3djejZW?= =?utf-8?B?MzcvdFc5bXJJVGU4cmlYVUwyK3I5Um50YnZ1SURXOXVJbWpEaFRXbTViLzNa?= =?utf-8?B?Zi9wb2ZhVGdnSjI0NDZCZVAzbFNQZ25wQzJmc2pIdCtmVzl2VS80SFdCZXNL?= =?utf-8?Q?TF8Q=3D?= 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)(30052699003)(1800799024)(82310400026)(376014)(7416014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2025 07:16:45.0596 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 96d4a9ba-42d2-452c-04f9-08de2804c313 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: BL6PEPF0002256E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8058 Hello John, On 11/20/2025 12:03 PM, John Stultz wrote: > On Wed, Nov 19, 2025 at 6:55 PM K Prateek Nayak wrote: >> On 11/20/2025 7:30 AM, John Stultz wrote: >>>> Ok, so you're suggesting maybe putting the >>>> if (task_on_rq_migrating(owner)) >>>> case ahead of the >>>> if (owner_cpu != this_cpu) >>>> check? >>>> >>>> Let me give that a whirl and see how it does. >>> >>> That said, thinking another second on it, I also realize once we >>> decide to proxy_migrate, there is always the chance the owner gets >>> migrated somewhere else. So we can check task_on_rq_migrating() but >>> then right after we check that it might be migrated, and we can't >>> really prevent this. And in that case, doing the proxy-migration to >>> the wrong place will be ok, as that cpu will then bounce the tasks to >>> the owner's new cpu. >>> >>> Hopefully this would be rare though. :) >> >> Ack! I was just thinking of some extreme scenarios. We can probably >> think about it if and when we run into a problem with it :) >> >> That said, once we decide to move the first donors to owner's CPU >> should we task some care to retain the owner on the same CPU as much >> as possible - take it out of the purview of load balancing and only >> move it if the owner is no long runnable on that CPU as a result of >> affinity changes? > > Eh, I'm hesitant to muck with the balancing effects on the lock > owners. If it's better for them to move around, then the donor chain > should follow along (which will happen naturally). So assume the case where you have the owner and a bunch of blocked donor on the same rq. This rq appears the busiest to the load balancer. Load balancer go thorough the task list and find that almost everything is blocked on the owner. Then it arrives at the owner in a preempted state (queued; not running) and thinks this is a good enough task to move to reduce imbalance. Now, this triggers a whole chain migration at pick for all the blocked donors to the new CPU. Seems wasteful (although again this is a very unlikely scenario to not be on_cpu with so many donors on the CPU) > > Now, the donors (or really any blocked tasks on the rq) we avoid > adding to any movable lists, since we only want proxy-migrations to > move those tasks (so they stick to the owner). -- Thanks and Regards, Prateek