From: Huang Shijie <shijie@os.amperecomputing.com>
To: mingo@redhat.com, peterz@infradead.org
Cc: patches@amperecomputing.com, cl@linux.com,
yang@os.amperecomputing.com, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
vschneid@redhat.com, linux-kernel@vger.kernel.org,
Huang Shijie <shijie@os.amperecomputing.com>
Subject: [PATCH] sched/fair: set the se->vlag strictly following the paper
Date: Thu, 19 Jun 2025 11:19:42 +0800 [thread overview]
Message-ID: <20250619031942.25474-1-shijie@os.amperecomputing.com> (raw)
From the paper, the lag should follow the limit:
-r_max < lag < max(r_max, q)
But current code makes the lag follow the limit:
-max(r_max, q) < lag < max(r_max, q)
This patch introduces limit_hi/limit_lo/r_max, and
make the lag follow the paper strictly.
Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
---
kernel/sched/fair.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 83157de5b808..102d263df330 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -694,14 +694,17 @@ u64 avg_vruntime(struct cfs_rq *cfs_rq)
*/
static void update_entity_lag(struct cfs_rq *cfs_rq, struct sched_entity *se)
{
- s64 vlag, limit;
+ s64 vlag, limit_hi, limit_lo, r_max;
WARN_ON_ONCE(!se->on_rq);
vlag = avg_vruntime(cfs_rq) - se->vruntime;
- limit = calc_delta_fair(max_t(u64, 2*se->slice, TICK_NSEC), se);
+ r_max = 2 * se->slice;
- se->vlag = clamp(vlag, -limit, limit);
+ limit_hi = calc_delta_fair(max_t(u64, r_max, TICK_NSEC), se);
+ limit_lo = calc_delta_fair(r_max, se);
+
+ se->vlag = clamp(vlag, -limit_lo, limit_hi);
}
/*
--
2.40.1
next reply other threads:[~2025-06-19 3:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 3:19 Huang Shijie [this message]
2025-06-19 13:53 ` Vincent Guittot
2025-06-20 3:00 ` Shijie Huang
2025-06-20 6:37 ` Vincent Guittot
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=20250619031942.25474-1-shijie@os.amperecomputing.com \
--to=shijie@os.amperecomputing.com \
--cc=bsegall@google.com \
--cc=cl@linux.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=patches@amperecomputing.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=yang@os.amperecomputing.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®