From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62B40372671 for ; Sat, 4 Apr 2026 05:36:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775281007; cv=none; b=hixlqtDSnNv/iQ6S3YRUgb9giRSTvPi9Fv2x8rCv0v7STyE6UgJR232PIdFXiMfyj4QZGTr2hOkyO5YJ2vRlfp75GyUUb3C9U5jVrF2GY/re05npOVW74OUtWxkfhlj14ftxEyP+b64kqLmvhcUhF9vK3z7mk4hZ3dD5OAYDt34= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775281007; c=relaxed/simple; bh=zJmssLbWxheN8lTEHo5/guRE7fIFkkHcLBJ9e6RvevA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Daa5qEPBHTh/K9iv/x+coSJBYb5wGsXbjp8YJxWJ7naVKlm2Mog2q9LI2VIxcg86s6G4BQUN9JCOlawI4UZmfvBsLIye9Tkjdv7DTaM28lT2dZ8WXoj8KYoomKv37AhavL2NMh3xjkosDFYQifw3mivhSvwUuvx7SdqmOXIe8D4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jstultz.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=kQPnqx6J; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jstultz.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="kQPnqx6J" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-82cf362659eso1683236b3a.2 for ; Fri, 03 Apr 2026 22:36:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775281006; x=1775885806; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=SS/m1t0uYn/C8977KxUQKuI5bWfm1tXXwup9Gurcm64=; b=kQPnqx6J4nXbkjWGYrF2UR4vOeTsbKAIqk0WRfeRSQj6yxiES/vT16LUB8zuv8MdCC cAzyMewSoHWUiM0sRx622e3Hylj7Gw9sJT/WKND1/BoeDaZcGJdxk9wjxcriWrPSHHZy M55rHFVmaufPrmGLBc6WWTDGh/ZdQVLuouZvfIuTngAXUyUoXreBgoSVupRqGkJXsxdv hP1L/YkDhT5c4qRPklhsJg0nhtxhNsyM1ISmYHIJep0GulczjYyo1vmNMfF2s4tMr6Xk Uw3vgiI8wsy88lArn1sFeJCJI4B3HMYOj0YSJph+ITIoOQV4B0xF5rGEFSKROCPPUsXO Hyqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775281006; x=1775885806; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SS/m1t0uYn/C8977KxUQKuI5bWfm1tXXwup9Gurcm64=; b=pr4z5lv6QWdw6MGotkZfufSErJ3+jAXS6mcKQ6mYdjfCXMqgyAp7IUEqirnfoW6qwE yGd4tIK9DkhQ5aYAE9PR+tyvXitAIM3DtaJlS4sR3eDbi8waz7nDBaEvT1nC9QrZMUVT z2hsjTnjKEKQJh6WnfZKSBTWrjmKp8Cxih9Gj1RXIVesp6zk8/f82LMMmnTlQE//8Dqu HnKuOSXK6A3MsQpsTT/ANO6gp/iuBe/4dJABlDRtiF0hj3SXyMv3FcV+4xSeIPnLuPhQ aSelL8D2cNQFHJkE/gKA/oPy3vzvRtwwnRrfk0t2kMVHutFa9p9BAMPUfTqCuSCD+YgK T1Bw== X-Gm-Message-State: AOJu0YzMlnSXHEzKGIsd8IpYa1WOUoKzQC2lNZi6QaNZfp1SUQYUKowz EiVHnGGSj45DSOiLxasq/RYIozLGIdcVX4KwCGLwP5WSk2bETvwcoOgbtmTnYf91kOAB6j0B8m1 rVTqjuaBifwcVwJtiuQb6hUe3T+RCfJLJrxOUUvBTUWvRTwhosb/IN2nExgUcbm8vDW+F4cbk+I VBKFBBbVlp8YrVCT+RU1ld7qXJNy9MK7dd4r7z/acVidcixfKp X-Received: from pgko24.prod.google.com ([2002:a63:f158:0:b0:c6e:8dba:9fcb]) (user=jstultz job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:2da8:b0:398:7cb3:2bf0 with SMTP id adf61e73a8af0-39f2f02b7a1mr3897912637.36.1775281005118; Fri, 03 Apr 2026 22:36:45 -0700 (PDT) Date: Sat, 4 Apr 2026 05:36:20 +0000 In-Reply-To: <20260404053632.1729280-1-jstultz@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260404053632.1729280-1-jstultz@google.com> X-Mailer: git-send-email 2.53.0.1213.gd9a14994de-goog Message-ID: <20260404053632.1729280-4-jstultz@google.com> Subject: [PATCH v27 03/10] sched: deadline: Add some helper variables to cleanup deadline logic From: John Stultz To: LKML Cc: John Stultz , Peter Zijlstra , Joel Fernandes , Qais Yousef , Ingo Molnar , 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 , K Prateek Nayak , Thomas Gleixner , Daniel Lezcano , Suleiman Souhlal , kuyo chang , hupu , kernel-team@android.com Content-Type: text/plain; charset="UTF-8" As part of an improvement to handling pushable deadline tasks, Peter suggested this cleanup[1], to use helper values for dl_entity and dl_rq in the enqueue_task_dl() and put_prev_task_dl() functions. There should be no functional change from this patch. To make sure this cleanup change doesn't obscure later logic changes, I've split it into its own patch. [1]: https://lore.kernel.org/lkml/20260304095123.GP606826@noisy.programming.kicks-ass.net/ Suggested-by: Peter Zijlstra Signed-off-by: John Stultz --- Cc: Joel Fernandes Cc: Qais Yousef Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Juri Lelli Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Valentin Schneider Cc: Steven Rostedt Cc: Ben Segall Cc: Zimuzo Ezeozue Cc: Mel Gorman Cc: Will Deacon Cc: Waiman Long Cc: Boqun Feng Cc: "Paul E. McKenney" Cc: Metin Kaya Cc: Xuewen Yan Cc: K Prateek Nayak Cc: Thomas Gleixner Cc: Daniel Lezcano Cc: Suleiman Souhlal Cc: kuyo chang Cc: hupu Cc: kernel-team@android.com --- kernel/sched/deadline.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 7352506208287..60ccb492c4427 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -2295,7 +2295,10 @@ static void dequeue_dl_entity(struct sched_dl_entity *dl_se, int flags) static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags) { - if (is_dl_boosted(&p->dl)) { + struct sched_dl_entity *dl_se = &p->dl; + struct dl_rq *dl_rq = &rq->dl; + + if (is_dl_boosted(dl_se)) { /* * Because of delays in the detection of the overrun of a * thread's runtime, it might be the case that a thread @@ -2308,14 +2311,14 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags) * * In this case, the boost overrides the throttle. */ - if (p->dl.dl_throttled) { + if (dl_se->dl_throttled) { /* * The replenish timer needs to be canceled. No * problem if it fires concurrently: boosted threads * are ignored in dl_task_timer(). */ - cancel_replenish_timer(&p->dl); - p->dl.dl_throttled = 0; + cancel_replenish_timer(dl_se); + dl_se->dl_throttled = 0; } } else if (!dl_prio(p->normal_prio)) { /* @@ -2327,7 +2330,7 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags) * being boosted again with no means to replenish the runtime and clear * the throttle. */ - p->dl.dl_throttled = 0; + dl_se->dl_throttled = 0; if (!(flags & ENQUEUE_REPLENISH)) printk_deferred_once("sched: DL de-boosted task PID %d: REPLENISH flag missing\n", task_pid_nr(p)); @@ -2336,14 +2339,14 @@ 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); + update_stats_wait_start_dl(dl_rq, dl_se); if (p->on_rq == TASK_ON_RQ_MIGRATING) flags |= ENQUEUE_MIGRATING; - enqueue_dl_entity(&p->dl, flags); + enqueue_dl_entity(dl_se, flags); - if (dl_server(&p->dl)) + if (dl_server(dl_se)) return; if (task_is_blocked(p)) @@ -2646,7 +2649,7 @@ static void put_prev_task_dl(struct rq *rq, struct task_struct *p, struct task_s struct sched_dl_entity *dl_se = &p->dl; struct dl_rq *dl_rq = &rq->dl; - if (on_dl_rq(&p->dl)) + if (on_dl_rq(dl_se)) update_stats_wait_start_dl(dl_rq, dl_se); update_curr_dl(rq); @@ -2656,7 +2659,7 @@ static void put_prev_task_dl(struct rq *rq, struct task_struct *p, struct task_s if (task_is_blocked(p)) return; - if (on_dl_rq(&p->dl) && p->nr_cpus_allowed > 1) + if (on_dl_rq(dl_se) && p->nr_cpus_allowed > 1) enqueue_pushable_dl_task(rq, p); } -- 2.53.0.1213.gd9a14994de-goog