All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Chris Mason <clm@meta.com>
Subject: [PATCH 6.18 3/5] sched/fair: Small cleanup to update_newidle_cost()
Date: Fri,  9 Jan 2026 12:44:05 +0100	[thread overview]
Message-ID: <20260109111950.476102220@linuxfoundation.org> (raw)
In-Reply-To: <20260109111950.344681501@linuxfoundation.org>

6.18-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Peter Zijlstra <peterz@infradead.org>

commit 08d473dd8718e4a4d698b1113a14a40ad64a909b upstream.

Simplify code by adding a few variables.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Tested-by: Chris Mason <clm@meta.com>
Link: https://patch.msgid.link/20251107161739.655208666@infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/sched/fair.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -12124,22 +12124,25 @@ void update_max_interval(void)
 
 static inline bool update_newidle_cost(struct sched_domain *sd, u64 cost)
 {
+	unsigned long next_decay = sd->last_decay_max_lb_cost + HZ;
+	unsigned long now = jiffies;
+
 	if (cost > sd->max_newidle_lb_cost) {
 		/*
 		 * Track max cost of a domain to make sure to not delay the
 		 * next wakeup on the CPU.
 		 */
 		sd->max_newidle_lb_cost = cost;
-		sd->last_decay_max_lb_cost = jiffies;
-	} else if (time_after(jiffies, sd->last_decay_max_lb_cost + HZ)) {
+		sd->last_decay_max_lb_cost = now;
+
+	} else if (time_after(now, next_decay)) {
 		/*
 		 * Decay the newidle max times by ~1% per second to ensure that
 		 * it is not outdated and the current max cost is actually
 		 * shorter.
 		 */
 		sd->max_newidle_lb_cost = (sd->max_newidle_lb_cost * 253) / 256;
-		sd->last_decay_max_lb_cost = jiffies;
-
+		sd->last_decay_max_lb_cost = now;
 		return true;
 	}
 



  parent reply	other threads:[~2026-01-09 11:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-09 11:44 [PATCH 6.18 0/5] 6.18.5-rc1 review Greg Kroah-Hartman
2026-01-09 11:44 ` [PATCH 6.18 1/5] mptcp: ensure context reset on disconnect() Greg Kroah-Hartman
2026-01-09 11:44 ` [PATCH 6.18 2/5] sched/fair: Small cleanup to sched_balance_newidle() Greg Kroah-Hartman
2026-01-09 11:44 ` Greg Kroah-Hartman [this message]
2026-01-09 11:44 ` [PATCH 6.18 4/5] sched/fair: Proportional newidle balance Greg Kroah-Hartman
2026-01-09 11:44 ` [PATCH 6.18 5/5] nfs/localio: fix regression due to out-of-order __put_cred Greg Kroah-Hartman
2026-01-09 13:17 ` [PATCH 6.18 0/5] 6.18.5-rc1 review Ronald Warsow
2026-01-09 13:55 ` Slade Watkins
2026-01-09 16:26 ` Achill Gilgenast
2026-01-09 17:32 ` Jon Hunter
2026-01-09 19:01 ` Brett A C Sheffield
2026-01-09 21:53 ` Brett Mastbergen
2026-01-09 22:06 ` Florian Fainelli
2026-01-09 23:56 ` Shuah Khan
2026-01-10  1:56 ` Peter Schneider
2026-01-10  4:17 ` Takeshi Ogasawara
2026-01-10  6:45 ` Ron Economos
2026-01-10  9:53 ` Jeffrin Thalakkottoor
2026-01-10 11:28 ` Mark Brown
2026-01-10 21:25 ` Miguel Ojeda
2026-01-12 10:23 ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260109111950.476102220@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=clm@meta.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=patches@lists.linux.dev \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.