Skip to content

Commit 41082c1

Browse files
committed
sched: Make cpu_shares_read_u64() use tg_weight()
Move tg_weight() upward and make cpu_shares_read_u64() use it too. This makes the weight retrieval shared between cgroup v1 and v2 paths and will be used to implement cgroup support for sched_ext. No functional changes. Signed-off-by: Tejun Heo <[email protected]>
1 parent 859dc4e commit 41082c1

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

kernel/sched/core.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9194,6 +9194,11 @@ static int cpu_uclamp_max_show(struct seq_file *sf, void *v)
91949194
#endif /* CONFIG_UCLAMP_TASK_GROUP */
91959195

91969196
#ifdef CONFIG_FAIR_GROUP_SCHED
9197+
static unsigned long tg_weight(struct task_group *tg)
9198+
{
9199+
return scale_load_down(tg->shares);
9200+
}
9201+
91979202
static int cpu_shares_write_u64(struct cgroup_subsys_state *css,
91989203
struct cftype *cftype, u64 shareval)
91999204
{
@@ -9205,9 +9210,7 @@ static int cpu_shares_write_u64(struct cgroup_subsys_state *css,
92059210
static u64 cpu_shares_read_u64(struct cgroup_subsys_state *css,
92069211
struct cftype *cft)
92079212
{
9208-
struct task_group *tg = css_tg(css);
9209-
9210-
return (u64) scale_load_down(tg->shares);
9213+
return tg_weight(css_tg(css));
92119214
}
92129215

92139216
#ifdef CONFIG_CFS_BANDWIDTH
@@ -9709,11 +9712,6 @@ static int cpu_local_stat_show(struct seq_file *sf,
97099712

97109713
#ifdef CONFIG_FAIR_GROUP_SCHED
97119714

9712-
static unsigned long tg_weight(struct task_group *tg)
9713-
{
9714-
return scale_load_down(tg->shares);
9715-
}
9716-
97179715
static u64 cpu_weight_read_u64(struct cgroup_subsys_state *css,
97189716
struct cftype *cft)
97199717
{

0 commit comments

Comments
 (0)