From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from MW6PR02CU001.outbound.protection.outlook.com (mail-westus2azon11012019.outbound.protection.outlook.com [52.101.48.19]) (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 8F081336881 for ; Thu, 5 Mar 2026 04:02:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.48.19 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772683336; cv=fail; b=LM3hA4/wtaAivN0Ji+odxUTXwM6TgIfGYsI9op9l/zwIYdKLUqBVXmUh0jap7XbeDdLY79e0hAfraEvhV1FTfoD1whCD0gqU4P4brQH81x1ZjiZob/zF+fCqLOSIMLyHYYH4iaAXKKwnzNEPDVwGhIH90jkokPqkvb8ueb5ukZU= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772683336; c=relaxed/simple; bh=4APpSEU8tQRgqKwVIVaO3XClVZdvh+E+jv03YTvnCuA=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=G2zqvX3gC8c65DtpPu2++bkJyTa699HGhz56T9/JXSDYdRxZ7CT77tVe9DgRV8lZdVWCc45Em2tOhPZYiUwx9ZXqHx9MxEqh+SsWXdDvZb2QigAwBMcTTGnlrEYevoCW1N1ko9U84qVHCh0QiyLJB9QegJKqGGwDJ0sIkhcqx/0= 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=yoCVJQaY; arc=fail smtp.client-ip=52.101.48.19 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="yoCVJQaY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=H6TO+EmWZJKM8j9NmALmhAAW9actuiYHBA23HLfuljwEm4FoAaDTItPPYzmABvCgq8XVar9SwyFCcDsKmGlUJrDoiUWoMmXChsefpohN8lhn4at/IoxXRpntvd5w8vNAMTUoeo5mlCA9R5XBfggr217qC/+Qh0DfhPUADiIVAr7aVOVMsO1cG61jdSDjoaOuTivy0tIgE2WqqJXDosd7bmaypxejBVTuEzClK5NTj+BRNxkGEk13z/tatB8fLyJU/pmS3F+G+S9UW/rqpR7a7Gf+343QKGsLuZxYsrhzoCEgndWFL1WE5vCTlfV0Q24lJ1fB/O4mQPbWhEIRKy/yTQ== 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=XTmkeIzYPe1ujVZgBI9Wg6PUOjLs3PlHoLkUbkrOjHg=; b=jWhRpFDAF1R+6rNodja7X/QGkGoUn8Se129mgeLRmT1ieuT1JEuXElS3slFEKMp4fBsUfTnZ8JdluaLhMpCpvr5N7XbWs4wQVyDRRggcWTfAFL+sdECxroEqkWev8ymgiEfDNvgVaq7+11NpLO70WJv9m4OaxLcfaWH2N+MsV2UZV+d3PvdMBRoCLUwupSMb9JtTe1achjYyGhSinonnERy3uezS3YcEut7GarmbPgA4xQ4Od8guIvDqkwdXIMr7VPbxH53D3AxkfMPgC4nzFB+KBrA8mdojYLR9H2IdJzeyG/zvPrTuRPKcvJHhar3aqIHusbUYSDErf020gtJD2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=infradead.org 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=XTmkeIzYPe1ujVZgBI9Wg6PUOjLs3PlHoLkUbkrOjHg=; b=yoCVJQaYoIV/EXwNNJgL2FsEnSnLLK3S3W9Rzt27SE3u9P1kT+Joxiy/VpqBATfyAGHkmqyMqBZr64SljcOul9K9glYC7E9K2rnvjzVYV0DMlagzzdDl0QdKto3eaLBcMhxr7V6AWGv3Z/QxPyb1WtuLuqzKW++CEa4F+VkjJ+s= Received: from SA0PR13CA0012.namprd13.prod.outlook.com (2603:10b6:806:130::17) by LV8PR12MB9135.namprd12.prod.outlook.com (2603:10b6:408:18c::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9654.23; Thu, 5 Mar 2026 04:02:12 +0000 Received: from SA2PEPF00001509.namprd04.prod.outlook.com (2603:10b6:806:130:cafe::6a) by SA0PR13CA0012.outlook.office365.com (2603:10b6:806:130::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9654.22 via Frontend Transport; Thu, 5 Mar 2026 04:02:12 +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 SA2PEPF00001509.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9678.18 via Frontend Transport; Thu, 5 Mar 2026 04:02:11 +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.17; Wed, 4 Mar 2026 22:02:11 -0600 Received: from [10.136.33.159] (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, 4 Mar 2026 22:02:06 -0600 Message-ID: Date: Thu, 5 Mar 2026 09:32:05 +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: [RFC][PATCH 2/2] sched: proxy-exec: Add allow/prevent_migration hooks in the sched classes for proxy_tag_curr To: Peter Zijlstra , John Stultz CC: LKML , zhidao su , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Valentin Schneider , Johannes Weiner , Steven Rostedt , Ben Segall , Mel Gorman , Joel Fernandes , Qais Yousef , Xuewen Yan , Suleiman Souhlal , kuyo chang , hupu , , References: <20260304063817.796180-1-jstultz@google.com> <20260304063817.796180-2-jstultz@google.com> <20260304131828.GR606826@noisy.programming.kicks-ass.net> Content-Language: en-US From: K Prateek Nayak In-Reply-To: <20260304131828.GR606826@noisy.programming.kicks-ass.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001509:EE_|LV8PR12MB9135:EE_ X-MS-Office365-Filtering-Correlation-Id: e51b015e-d519-41ff-7a71-08de7a6bfa7c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|82310400026|1800799024|36860700016; X-Microsoft-Antispam-Message-Info: bxcKo+iGf3YfWJLVNcQMgeuwfuuPVfciUIqt7jU6EEo9+l7JznW700IU3uPCPsnPj+y+h426jD1guKQNQwNCNBLZHxTPxNfGmW1pVvxnFhQNMew53BQphdLkww3bKy+gCK83FbjoT769BHD0qoms7r4iS0/YRERu5/QAey5mWE/UaI4X8kwIn34XIPKB0+wVmV5BNPiQKrcvv2PxxyYxIfRZ/wmYJHXTzw06F7ZmPo9N+4KBD+JU4LD2aOgpFHaXNVaS0Q1QKDiYM++6Z7EOhKBGqsOfN5szB9iMQLgOmii6bD9YQvUsm6BKw+hQgyDF2hUPH6N4b+PLFee0TpBGwryNmQh1G/WtEjHx6T3r1mGw+JxxCSFG4Fe4Sc84cmRbzMLr7XdzIutLF0Cab3z/zyav4pVO1tHFVeaokOt6Byg8TNckRRQM1vCpl5fV5uNuC/Mnh/lUmYHaGkDwYyehcaOtUwF1Nk42II2+umGlN/DKSfgUIT815aHPpXF38qtCNbGuilhmxxZpy5yQPyhAms0k/RlhOmXF+0jScOP+qmpvDfGYpE4r7GknQu2QzvvaN2x0ERsHkCuoWAZeVFSy68eB+g/51evFsEJP6TSH776o6DBuFo+QDEvo8lJkJ3mei0yQwi/w9brhUV3N25jjWtkpeyWqex0L8V9UvIDUPRDgEzxijan+ygDjfHQwRJJZmVuj+6KUwMJUzlPcVT76CNC9NN7mt4IpPNNea9zGSa8xj5QJQ6TkSy4rMPy+cKlbSLjHJ6ejI8UZdXi4a/b1MA== 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)(376014)(82310400026)(1800799024)(36860700016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oEjwzHanOtx3zL89EUE/Mh2U7oBCzudntRvjwETmM4TWV1Hih62RZ9JpmErSfqTovhaw6lF3kTSXajVHHLjQucPwHWuWO4YQJOe2LREuWngIWcwW2K3dNpC/i0manu6Fv51kriwWfjT8lMq5L4O3Xmb6MtEkDMH5TcU4fJZ6NiKZAe2tvgBI2rjTMIhjhkqG8KNBOKAXE4HIRQu5w8GUNSPC1iXIe2oDEECWICAaWvLFOVB33ZNVsckF3GfdL5T0ayciPHMc/x6yax8xNu5eh8s7y8zkjecg4quI8XQuxkY+deCWeDMCmI5ftMPNmRzVKVWZZl3ShweboAQgxerAr2KUJbMRBElzSDvvLr0zu0QwJBz9a6z1fiYbTa6XDqetU0y43uy/2TnMSKfLlJiLV9nRH0gePzbqBR36/mRuuHJALn/3cSWLxLWdWbdNz3d5 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2026 04:02:11.5137 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e51b015e-d519-41ff-7a71-08de7a6bfa7c 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: SA2PEPF00001509.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9135 Hello Peter, On 3/4/2026 6:48 PM, Peter Zijlstra wrote: > +static inline void set_proxy_task(struct task_struct *p) > { > - if (!sched_proxy_exec()) > - return; > - /* > - * pick_next_task() calls set_next_task() on the chosen task > - * at some point, which ensures it is not push/pullable. > - * However, the chosen/donor task *and* the mutex owner form an > - * atomic pair wrt push/pull. > - * > - * Make sure owner we run is not pushable. Unfortunately we can > - * only deal with that by means of a dequeue/enqueue cycle. :-/ > - */ > - dequeue_task(rq, owner, DEQUEUE_NOCLOCK | DEQUEUE_SAVE); > - enqueue_task(rq, owner, ENQUEUE_NOCLOCK | ENQUEUE_RESTORE); > + WARN_ON_ONCE(p->migration_flags & MDF_PROXY); > + p->migration_flags |= MDF_PROXY; > + p->migration_disabled++; > +} > + > +static inline void put_proxy_task(struct task_struct *p) > +{ > + WARN_ON_ONCE(!(p->migration_flags & MDF_PROXY)); > + p->migration_flags &= ~MDF_PROXY; > + p->migration_disabled--; Note: I'm not too familiar with the set_affinity bits so my understanding might be all wrong but ... Doesn't the set_affinity bits have a completion based wait for tasks that are migration disabled? If we have a case like: P0 P1 == == migrate_disable() p->migration_disabled++; /* 1 */ ... mutex_lock() ... /* preempted */ /* proxied */ set_proxy_task(P0) p->migration_disabled++; /* 2 */ ... /* Continues running */ set_cpus_allowed_ptr(P0) /* Task CPU not in the new mask. */ affine_move_task() /* * blocks as per the comment * above affine_move_task(). */ migrate_enable() if (p->migration_disabled > 1) p->migration_disabled--; /* 1 */ return; ... mutex_unlock(); /* Goes into schedule. */ put_proxy_task(P0) p->migration_disabled--; /* 0 */ /* !!! Who does the migration + wakeup? !!! */ Isn't it up to the last migrate_enable() (or in this case, put_proxy_task()) to schedule in the stopper and push the prev to another CPU? Or is it handled in some other way? > } -- Thanks and Regards, Prateek