From: Ingo Molnar <mingo@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Valentin Schneider <vschneid@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Shrikanth Hegde <sshegde@linux.ibm.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Mel Gorman <mgorman@suse.de>,
Steven Rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>
Subject: [PATCH 4/6] sched/fair: Rename avg_vruntime() to cfs_avg_vruntime()
Date: Mon, 1 Dec 2025 07:46:45 +0100 [thread overview]
Message-ID: <20251201064647.1851919-5-mingo@kernel.org> (raw)
In-Reply-To: <20251201064647.1851919-1-mingo@kernel.org>
Since the unit of the ->avg_vruntime field isn't actually
the same thing as the avg_vruntime() result, reduce confusion
and rename the latter to the common cfs_*() nomenclature of
visible global functions of the fair scheduler.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/sched/debug.c | 2 +-
kernel/sched/fair.c | 10 +++++-----
kernel/sched/sched.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 41caa22e0680..a6ceda12bd35 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -829,7 +829,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "zero_vruntime",
SPLIT_NS(zero_vruntime));
SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "avg_vruntime",
- SPLIT_NS(avg_vruntime(cfs_rq)));
+ SPLIT_NS(cfs_avg_vruntime(cfs_rq)));
SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "right_vruntime",
SPLIT_NS(right_vruntime));
spread = right_vruntime - left_vruntime;
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 769d7b7990df..3d6d551168aa 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -651,7 +651,7 @@ void avg_vruntime_update(struct cfs_rq *cfs_rq, s64 delta)
* Specifically: avg_runtime() + 0 must result in entity_eligible() := true
* For this to be so, the result of this function must have a left bias.
*/
-u64 avg_vruntime(struct cfs_rq *cfs_rq)
+u64 cfs_avg_vruntime(struct cfs_rq *cfs_rq)
{
struct sched_entity *curr = cfs_rq->curr;
s64 avg = cfs_rq->avg_vruntime;
@@ -696,7 +696,7 @@ static void update_entity_lag(struct cfs_rq *cfs_rq, struct sched_entity *se)
WARN_ON_ONCE(!se->on_rq);
- vlag = avg_vruntime(cfs_rq) - se->vruntime;
+ vlag = cfs_avg_vruntime(cfs_rq) - se->vruntime;
limit = calc_delta_fair(max_t(u64, 2*se->slice, TICK_NSEC), se);
se->vlag = clamp(vlag, -limit, limit);
@@ -716,7 +716,7 @@ static void update_entity_lag(struct cfs_rq *cfs_rq, struct sched_entity *se)
*
* lag_i >= 0 -> \Sum (v_i - v)*w_i >= (v_i - v)*(\Sum w_i)
*
- * Note: using 'avg_vruntime() > se->vruntime' is inaccurate due
+ * Note: using 'cfs_avg_vruntime() > se->vruntime' is inaccurate due
* to the loss in precision caused by the division.
*/
static int vruntime_eligible(struct cfs_rq *cfs_rq, u64 vruntime)
@@ -742,7 +742,7 @@ int entity_eligible(struct cfs_rq *cfs_rq, struct sched_entity *se)
static void update_zero_vruntime(struct cfs_rq *cfs_rq)
{
- u64 vruntime = avg_vruntime(cfs_rq);
+ u64 vruntime = cfs_avg_vruntime(cfs_rq);
s64 delta = (s64)(vruntime - cfs_rq->zero_vruntime);
avg_vruntime_update(cfs_rq, delta);
@@ -5099,7 +5099,7 @@ void __setparam_fair(struct task_struct *p, const struct sched_attr *attr)
static void
place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
{
- u64 vslice, vruntime = avg_vruntime(cfs_rq);
+ u64 vslice, vruntime = cfs_avg_vruntime(cfs_rq);
s64 lag = 0;
if (!se->custom_slice)
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 6bfcf52a4840..47f7b6df634c 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -3956,7 +3956,7 @@ static inline void task_tick_mm_cid(struct rq *rq, struct task_struct *curr) { }
static inline void init_sched_mm_cid(struct task_struct *t) { }
#endif /* !CONFIG_SCHED_MM_CID */
-extern u64 avg_vruntime(struct cfs_rq *cfs_rq);
+extern u64 cfs_avg_vruntime(struct cfs_rq *cfs_rq);
extern int entity_eligible(struct cfs_rq *cfs_rq, struct sched_entity *se);
static inline
void move_queued_task_locked(struct rq *src_rq, struct rq *dst_rq, struct task_struct *task)
--
2.51.0
next prev parent reply other threads:[~2025-12-01 6:47 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-01 6:46 [PATCH 0/6] sched: Misc cleanups Ingo Molnar
2025-12-01 6:46 ` [PATCH 1/6] sched/fair: Join two #ifdef CONFIG_CFS_BANDWIDTH blocks Ingo Molnar
2025-12-04 5:53 ` Shrikanth Hegde
2025-12-06 10:48 ` Ingo Molnar
2025-12-14 7:46 ` [tip: sched/core] sched/fair: Join two #ifdef CONFIG_FAIR_GROUP_SCHED blocks tip-bot2 for Ingo Molnar
2025-12-15 7:59 ` tip-bot2 for Ingo Molnar
2025-12-01 6:46 ` [PATCH 2/6] sched/fair: Clean up comments in 'struct cfs_rq' Ingo Molnar
2025-12-14 7:46 ` [tip: sched/core] " tip-bot2 for Ingo Molnar
2025-12-15 7:59 ` tip-bot2 for Ingo Molnar
2025-12-01 6:46 ` [PATCH 3/6] sched/fair: Separate se->vlag from se->vprot Ingo Molnar
2025-12-01 8:06 ` [PATCH 3/6 v2] " Ingo Molnar
2025-12-14 7:46 ` [tip: sched/core] " tip-bot2 for Ingo Molnar
2025-12-15 7:59 ` tip-bot2 for Ingo Molnar
2025-12-01 6:46 ` Ingo Molnar [this message]
2025-12-02 10:24 ` [PATCH 4/6] sched/fair: Rename avg_vruntime() to cfs_avg_vruntime() Peter Zijlstra
2025-12-02 15:15 ` Ingo Molnar
2025-12-01 6:46 ` [PATCH 5/6] sched/fair: Rename cfs_rq::avg_load to cfs_rq::sum_weight Ingo Molnar
2025-12-02 10:27 ` Peter Zijlstra
2025-12-02 15:57 ` Ingo Molnar
2025-12-14 7:46 ` [tip: sched/core] " tip-bot2 for Ingo Molnar
2025-12-15 7:59 ` tip-bot2 for Ingo Molnar
2025-12-01 6:46 ` [PATCH 6/6] sched/fair: Rename cfs_rq::avg_vruntime to ::sum_w_vruntime, and helper functions Ingo Molnar
2025-12-02 10:35 ` Peter Zijlstra
2025-12-02 15:19 ` Ingo Molnar
2025-12-14 7:46 ` [tip: sched/core] " tip-bot2 for Ingo Molnar
2025-12-15 7:59 ` tip-bot2 for Ingo Molnar
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=20251201064647.1851919-5-mingo@kernel.org \
--to=mingo@kernel.org \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sshegde@linux.ibm.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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