Skip to content

Commit a33b5a0

Browse files
committed
Merge tag 'sched_ext-for-6.15-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext
Pull sched_ext fixes from Tejun Heo: - Use kvzalloc() so that large exit_dump buffer allocations don't fail easily - Remove cpu.weight / cpu.idle unimplemented warnings which are more annoying than helpful. This makes SCX_OPS_HAS_CGROUP_WEIGHT unnecessary. Mark it for deprecation * tag 'sched_ext-for-6.15-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext: sched_ext: Mark SCX_OPS_HAS_CGROUP_WEIGHT for deprecation sched_ext: Remove cpu.weight / cpu.idle unimplemented warnings sched_ext: Use kvzalloc for large exit_dump allocation
2 parents a22509a + bc08b15 commit a33b5a0

File tree

2 files changed

+8
-44
lines changed

2 files changed

+8
-44
lines changed

kernel/sched/ext.c

Lines changed: 7 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ enum scx_ops_flags {
163163
/*
164164
* CPU cgroup support flags
165165
*/
166-
SCX_OPS_HAS_CGROUP_WEIGHT = 1LLU << 16, /* cpu.weight */
166+
SCX_OPS_HAS_CGROUP_WEIGHT = 1LLU << 16, /* DEPRECATED, will be removed on 6.18 */
167167

168168
SCX_OPS_ALL_FLAGS = SCX_OPS_KEEP_BUILTIN_IDLE |
169169
SCX_OPS_ENQ_LAST |
@@ -3899,35 +3899,6 @@ bool scx_can_stop_tick(struct rq *rq)
38993899

39003900
DEFINE_STATIC_PERCPU_RWSEM(scx_cgroup_rwsem);
39013901
static bool scx_cgroup_enabled;
3902-
static bool cgroup_warned_missing_weight;
3903-
static bool cgroup_warned_missing_idle;
3904-
3905-
static void scx_cgroup_warn_missing_weight(struct task_group *tg)
3906-
{
3907-
if (scx_ops_enable_state() == SCX_OPS_DISABLED ||
3908-
cgroup_warned_missing_weight)
3909-
return;
3910-
3911-
if ((scx_ops.flags & SCX_OPS_HAS_CGROUP_WEIGHT) || !tg->css.parent)
3912-
return;
3913-
3914-
pr_warn("sched_ext: \"%s\" does not implement cgroup cpu.weight\n",
3915-
scx_ops.name);
3916-
cgroup_warned_missing_weight = true;
3917-
}
3918-
3919-
static void scx_cgroup_warn_missing_idle(struct task_group *tg)
3920-
{
3921-
if (!scx_cgroup_enabled || cgroup_warned_missing_idle)
3922-
return;
3923-
3924-
if (!tg->idle)
3925-
return;
3926-
3927-
pr_warn("sched_ext: \"%s\" does not implement cgroup cpu.idle\n",
3928-
scx_ops.name);
3929-
cgroup_warned_missing_idle = true;
3930-
}
39313902

39323903
int scx_tg_online(struct task_group *tg)
39333904
{
@@ -3937,8 +3908,6 @@ int scx_tg_online(struct task_group *tg)
39373908

39383909
percpu_down_read(&scx_cgroup_rwsem);
39393910

3940-
scx_cgroup_warn_missing_weight(tg);
3941-
39423911
if (scx_cgroup_enabled) {
39433912
if (SCX_HAS_OP(cgroup_init)) {
39443913
struct scx_cgroup_init_args args =
@@ -4076,9 +4045,7 @@ void scx_group_set_weight(struct task_group *tg, unsigned long weight)
40764045

40774046
void scx_group_set_idle(struct task_group *tg, bool idle)
40784047
{
4079-
percpu_down_read(&scx_cgroup_rwsem);
4080-
scx_cgroup_warn_missing_idle(tg);
4081-
percpu_up_read(&scx_cgroup_rwsem);
4048+
/* TODO: Implement ops->cgroup_set_idle() */
40824049
}
40834050

40844051
static void scx_cgroup_lock(void)
@@ -4272,9 +4239,6 @@ static int scx_cgroup_init(void)
42724239

42734240
percpu_rwsem_assert_held(&scx_cgroup_rwsem);
42744241

4275-
cgroup_warned_missing_weight = false;
4276-
cgroup_warned_missing_idle = false;
4277-
42784242
/*
42794243
* scx_tg_on/offline() are excluded through scx_cgroup_rwsem. If we walk
42804244
* cgroups and init, all online cgroups are initialized.
@@ -4284,9 +4248,6 @@ static int scx_cgroup_init(void)
42844248
struct task_group *tg = css_tg(css);
42854249
struct scx_cgroup_init_args args = { .weight = tg->scx_weight };
42864250

4287-
scx_cgroup_warn_missing_weight(tg);
4288-
scx_cgroup_warn_missing_idle(tg);
4289-
42904251
if ((tg->scx_flags &
42914252
(SCX_TG_ONLINE | SCX_TG_INITED)) != SCX_TG_ONLINE)
42924253
continue;
@@ -4623,7 +4584,7 @@ static void scx_ops_bypass(bool bypass)
46234584

46244585
static void free_exit_info(struct scx_exit_info *ei)
46254586
{
4626-
kfree(ei->dump);
4587+
kvfree(ei->dump);
46274588
kfree(ei->msg);
46284589
kfree(ei->bt);
46294590
kfree(ei);
@@ -4639,7 +4600,7 @@ static struct scx_exit_info *alloc_exit_info(size_t exit_dump_len)
46394600

46404601
ei->bt = kcalloc(SCX_EXIT_BT_LEN, sizeof(ei->bt[0]), GFP_KERNEL);
46414602
ei->msg = kzalloc(SCX_EXIT_MSG_LEN, GFP_KERNEL);
4642-
ei->dump = kzalloc(exit_dump_len, GFP_KERNEL);
4603+
ei->dump = kvzalloc(exit_dump_len, GFP_KERNEL);
46434604

46444605
if (!ei->bt || !ei->msg || !ei->dump) {
46454606
free_exit_info(ei);
@@ -5252,6 +5213,9 @@ static int validate_ops(const struct sched_ext_ops *ops)
52525213
return -EINVAL;
52535214
}
52545215

5216+
if (ops->flags & SCX_OPS_HAS_CGROUP_WEIGHT)
5217+
pr_warn("SCX_OPS_HAS_CGROUP_WEIGHT is deprecated and a noop\n");
5218+
52555219
return 0;
52565220
}
52575221

tools/sched_ext/scx_flatcg.bpf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,5 +950,5 @@ SCX_OPS_DEFINE(flatcg_ops,
950950
.cgroup_move = (void *)fcg_cgroup_move,
951951
.init = (void *)fcg_init,
952952
.exit = (void *)fcg_exit,
953-
.flags = SCX_OPS_HAS_CGROUP_WEIGHT | SCX_OPS_ENQ_EXITING,
953+
.flags = SCX_OPS_ENQ_EXITING,
954954
.name = "flatcg");

0 commit comments

Comments
 (0)