From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from DM5PR21CU001.outbound.protection.outlook.com (mail-centralusazon11011025.outbound.protection.outlook.com [52.101.62.25]) (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 387303385AA for ; Mon, 8 Jun 2026 07:10:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.62.25 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780902641; cv=fail; b=u7Up2iSFofGzcMTh5eh40N4Pw2sigUV4BWfPQshFXIzuqlWbRUAPBE/5gYyMVOhUspf/TndZneDdceZmddgHK8vc3JMFmcnIY7hUUjEuHBqcvlGdPEWY3F1d5qLD9k5mmMwf9x4bAU+RTXgYnAElqjMDZOEy+2n1LL8Zlh2JKvw= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780902641; c=relaxed/simple; bh=uHKlElXYyLlSuiNkDueo0MXDle82CGkvpYTMN9QwVIw=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=fCGnXBb+MsLl/oyuX3lOtOu0e5fGL2tP63WQ3B4RPMnHg4M6BsS9bRKBGaAl3PTjy7CB3/y9KYNNlxhgCF1+N/g3NsX8o4Rn0FjAzE7SOEeCemwaX0KpEvD/a7GgoGHQB1XUzDBZUS10T+5ZDVZh80bdbBtMuvZ07pUwJ6U+zJo= 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=ijwZNR4t; arc=fail smtp.client-ip=52.101.62.25 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="ijwZNR4t" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XtiPKFKyGtIlVRhMTyVnwKrkfBw00tTQ8KDQnY93ounS4/48oIaguNaxHi4hRWBhK53PTwryVX8v2T6L5ePJm2z/02C4MiKLCIFFnAoCbLboCQRK82stw71iXiqu00x7W+e2aPlmvwb5Jrcm4eS5ztoqjOqz0DynTJkU7Vj9VfBqLZnMYrDBf595x60ykXbQ6bNw7Rn7AqoPH5si2TZP1+t9CEV6rk39qNLJC4aLgftqnbbpgXAKfkkhu6fx677EpgCQkT48Y7LuH/TTynRG54ntl6RnRMF+46cngcHsxg3+QR2jGXeaHe/gdI0rIG1GZRNmDm0j6HezjCPf82B29Q== 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=Ao0y/xS4GJfT0fasAOkGs83v2VZkFsZ64kT9fq6P2ZY=; b=KxkvhiQSz8+riA55F/H10sg5iT14QC/j1dyhZdlA9o6I8FV557jtjtmpenhydPDigaOPgBCZvVzw7uXCMPuiRInOut+L4WFe2cgZVgQ7mWpuaWEADpIOHn4fzPsLjZMBCz1Vf+Iu2mrwmiGBy5womM68fiAjZ+lYBusdltiJl4woI0OEHBHi6S3i34p7pRKt1G2EP1fbIbgDoRQGAVBre1M4dQ96/d+L1wVDT5iI6Xx8LL2acCAr4//eP5WHbYyMjGA7l6/WbHnBk6U/4GFeBbJRP19C2IlSpyRvS8vkTEkhgECxF4YfZ0HQsS6EeWi5D4titfEu4AC1QGfeTo7fgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kylinos.cn 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=Ao0y/xS4GJfT0fasAOkGs83v2VZkFsZ64kT9fq6P2ZY=; b=ijwZNR4tUQLzmLhNAaJP+S++BW7QzxPLebaIaxGXZGY5WQfhVS/lTSZwby7GQaMNO7/VMKB9jZ5e0xmXK/wuLB1lnNIjI9WaZxJ5Tw7WvQgoloWQvJFuDpSOfRVd5CzWhcd4TyxQiCOFZhu/XP5cXZQRzqJX3EAnPRaUNaYV7g8= Received: from BN9PR03CA0472.namprd03.prod.outlook.com (2603:10b6:408:139::27) by PH0PR12MB7789.namprd12.prod.outlook.com (2603:10b6:510:283::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.92.13; Mon, 8 Jun 2026 07:10:33 +0000 Received: from BN3PEPF0000B078.namprd04.prod.outlook.com (2603:10b6:408:139:cafe::7b) by BN9PR03CA0472.outlook.office365.com (2603:10b6:408:139::27) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.92.12 via Frontend Transport; Mon, 8 Jun 2026 07:10:32 +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 BN3PEPF0000B078.mail.protection.outlook.com (10.167.243.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.113.7 via Frontend Transport; Mon, 8 Jun 2026 07:10:31 +0000 Received: from Satlexmb09.amd.com (10.181.42.218) 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.41; Mon, 8 Jun 2026 02:10:30 -0500 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.41; Mon, 8 Jun 2026 00:10:30 -0700 Received: from [10.136.43.95] (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.41 via Frontend Transport; Mon, 8 Jun 2026 02:10:27 -0500 Message-ID: <588d2bf2-824b-4c06-82b6-15892d1263da@amd.com> Date: Mon, 8 Jun 2026 12:40:21 +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] sched/deadline: Use task_on_rq_migrating() helper To: , Ingo Molnar , Peter Zijlstra CC: Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , "Mel Gorman" , Valentin Schneider , References: <20260608065307.280995-1-luoliang@kylinos.cn> Content-Language: en-US From: K Prateek Nayak In-Reply-To: <20260608065307.280995-1-luoliang@kylinos.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B078:EE_|PH0PR12MB7789:EE_ X-MS-Office365-Filtering-Correlation-Id: 737f1511-604e-4212-d1f8-08dec52d06d4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700016|7416014|376014|82310400026|22082099003|18002099003|6133799003|11063799006|56012099006; X-Microsoft-Antispam-Message-Info: Y5DMO6n+LJExv4T3Jj23hWnkb75MLmWknOHRpJgv0eNddI0lvKwa+ByXNtPeVuuKQ3OvbMgoZ21tUVLBffIurmH4gX1KbWudop/Tq3SJ4nfSr4WdjsaXYVU3tgdXb8IEBcGF4wMLeQKhju87xFOODGNh6qt9zBRdwk05VL89ebVyO+r3lhFF0Gapc+7hCGXzxyNrvq7NG9BGYRmUnMwr7n2BBmCm/h1MPLLUskmD3cGvnwfGiCsDi2cCpD7OnzjYa560s6EBT9qGerWV0JgVj4fwlFnyCFu4TOJUucdFtkD2m6yI5BLmslKRl8Pf6lVtaOzytz73O7xbOHqYLlqCWhtqiyztSQur6PN7B7yqGqAhQYoJ6yYOZs55VpHjUM+h45QfxPxl3oBQgBN01nxylYgR/QLwu8eNLqcsIxrFm0ETWtRiGx9O4NEEcpEfZJcK0JCChJJUncSgds2ebLULHXWoH0K+bLaIs1Duta/jPDp21SZBAXehGPx6NQKPq6OmZ6xVl6ZpeMwdmGfizSaaEkPQxQPFQxRXdRvVgh21Bn1gm8z91BzA0v2rvFtK2Z2s/e/Z/i7SkKnDyzuiBGCFQM2FEIpQwT6HIUM3HknP5iIcrBlXEMtUzwFwoB+K/cFopwZwU3Kk8rD/dfniEikmkL3XX1nFTTcxV6iS3DaYMSnaF7+DU0bPzlxEP+7h4Y5gSXXQKCwjafSgpcDYtE7V6szAtL2gSqM4nkXwyoxLPoI= 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)(1800799024)(36860700016)(7416014)(376014)(82310400026)(22082099003)(18002099003)(6133799003)(11063799006)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: njSE2OWuaL4ginwtXOaNgnmKNQTkoDbbAh7iiE8K/tETHdM1h1GU8afUxAJvqE8XuEdL8VCM7J9vTt6Mx3y2c8HyaJvdcDhNuHbldtPlJOMOHW+Ne9eGPECU7abgIHIe51UKCWc4T5JC9Kf4q2NF8WYDPcYrKp51Xr9l6JB8cW7BPGHXs9cL3C1Ybr88bCy15l3AuSoqeGtrL2BAnxLcmogAulJX4kvlx9L8bvPypySKNKtaZHHaXnQ146ZV+0flXgMi7qykctOHjLMZ0/t1d3oK9N9Kr5qFVhaQI9sstlgJzkuteekkRes7vMI1i5tjNiGm736sWyri6YIwW44wBSJpBrchvZEXxWz3nvKsGkvDGuEEJN3ZnSOVaW5iaNCQsgiiFONoew8Trjqrs29u/wJWXdbPHvlfy/TOBCU7lge4xDIdIoZ2PiSmSemOsWt7 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2026 07:10:31.1572 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 737f1511-604e-4212-d1f8-08dec52d06d4 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: BN3PEPF0000B078.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7789 Hello Liang, On 6/8/2026 12:23 PM, luoliang@kylinos.cn wrote: > From: Liang Luo > > Replace the open-coded "p->on_rq == TASK_ON_RQ_MIGRATING" comparisons > in enqueue_task_dl() and dequeue_task_dl() with the existing > task_on_rq_migrating() helper, consistent with the rest of the > scheduler code. Good cleanup but ... > > The helper uses READ_ONCE() when loading ->on_rq, which was added by > commit c546951d9c93 ("sched/core: Use READ_ONCE()/WRITE_ONCE() in > move_queued_task()/task_rq_lock()") for LKMM compliance. As documented > in that commit, move_queued_task() synchronizes with task_rq_lock(): > > move_queued_task() task_rq_lock() > [S] ->on_rq = MIGRATING [L] rq = task_rq() > WMB (__set_task_cpu()) ACQUIRE (rq->lock) > [S] ->cpu = new_cpu [L] ->on_rq > > The READ_ONCE() on the ->on_rq load ensures proper pairing with the > WRITE_ONCE() on the writer side. The open-coded checks in deadline.c > lack this annotation. ... this extra context feels unnecessary since the p->on_rq indicator is always stable at the time of dequeue / enqueue. The calling context already holds the rq_lock() (and sometimes, also the p->pi_lock) so there are no concurrent writers for it to pair with - in fact this same context will set p->on_rq back to TASK_ON_RQ_QUEUED after it is done enqueuing and before dropping the rq_lock(). > > No functional change. > > Signed-off-by: Liang Luo For the change itself, feel free to include: Reviewed-by: K Prateek Nayak > --- > kernel/sched/deadline.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c > index 7db4c87df83b..9d2c42b8661f 100644 > --- a/kernel/sched/deadline.c > +++ b/kernel/sched/deadline.c > @@ -2335,7 +2335,7 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags) > check_schedstat_required(); > update_stats_wait_start_dl(dl_rq_of_se(&p->dl), &p->dl); > > - if (p->on_rq == TASK_ON_RQ_MIGRATING) > + if (task_on_rq_migrating(p)) > flags |= ENQUEUE_MIGRATING; > > enqueue_dl_entity(&p->dl, flags); > @@ -2354,7 +2354,7 @@ static bool dequeue_task_dl(struct rq *rq, struct task_struct *p, int flags) > { > update_curr_dl(rq); > > - if (p->on_rq == TASK_ON_RQ_MIGRATING) > + if (task_on_rq_migrating(p)) > flags |= DEQUEUE_MIGRATING; > > dequeue_dl_entity(&p->dl, flags); > -- > 2.25.1 > -- Thanks and Regards, Prateek