Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sched_ext: Merge branch 'for-6.14-fixes' into for-6.15

Pull for-6.14-fixes to receive:

9360dfe4cbd6 ("sched_ext: Validate prev_cpu in scx_bpf_select_cpu_dfl()")

which conflicts with:

337d1b354a29 ("sched_ext: Move built-in idle CPU selection policy to a separate file")

Signed-off-by: Tejun Heo <tj@kernel.org>

+25 -11
+10 -7
kernel/sched/ext.c
··· 3250 3250 { 3251 3251 struct task_struct *prev = rq->curr; 3252 3252 struct task_struct *p; 3253 - bool prev_on_scx = prev->sched_class == &ext_sched_class; 3254 3253 bool keep_prev = rq->scx.flags & SCX_RQ_BAL_KEEP; 3255 3254 bool kick_idle = false; 3256 3255 ··· 3269 3270 * if pick_task_scx() is called without preceding balance_scx(). 3270 3271 */ 3271 3272 if (unlikely(rq->scx.flags & SCX_RQ_BAL_PENDING)) { 3272 - if (prev_on_scx) { 3273 + if (prev->scx.flags & SCX_TASK_QUEUED) { 3273 3274 keep_prev = true; 3274 3275 } else { 3275 3276 keep_prev = false; 3276 3277 kick_idle = true; 3277 3278 } 3278 - } else if (unlikely(keep_prev && !prev_on_scx)) { 3279 - /* only allowed during transitions */ 3279 + } else if (unlikely(keep_prev && 3280 + prev->sched_class != &ext_sched_class)) { 3281 + /* 3282 + * Can happen while enabling as SCX_RQ_BAL_PENDING assertion is 3283 + * conditional on scx_enabled() and may have been skipped. 3284 + */ 3280 3285 WARN_ON_ONCE(scx_ops_enable_state() == SCX_OPS_ENABLED); 3281 3286 keep_prev = false; 3282 3287 } ··· 3547 3544 curr->scx.slice = 0; 3548 3545 touch_core_sched(rq, curr); 3549 3546 } else if (SCX_HAS_OP(tick)) { 3550 - SCX_CALL_OP(SCX_KF_REST, tick, curr); 3547 + SCX_CALL_OP_TASK(SCX_KF_REST, tick, curr); 3551 3548 } 3552 3549 3553 3550 if (!curr->scx.slice) ··· 3694 3691 WARN_ON_ONCE(scx_get_task_state(p) != SCX_TASK_ENABLED); 3695 3692 3696 3693 if (SCX_HAS_OP(disable)) 3697 - SCX_CALL_OP(SCX_KF_REST, disable, p); 3694 + SCX_CALL_OP_TASK(SCX_KF_REST, disable, p); 3698 3695 scx_set_task_state(p, SCX_TASK_READY); 3699 3696 } 3700 3697 ··· 3723 3720 } 3724 3721 3725 3722 if (SCX_HAS_OP(exit_task)) 3726 - SCX_CALL_OP(SCX_KF_REST, exit_task, p, &args); 3723 + SCX_CALL_OP_TASK(SCX_KF_REST, exit_task, p, &args); 3727 3724 scx_set_task_state(p, SCX_TASK_NONE); 3728 3725 } 3729 3726
+3
kernel/sched/ext_idle.c
··· 800 800 __bpf_kfunc s32 scx_bpf_select_cpu_dfl(struct task_struct *p, s32 prev_cpu, 801 801 u64 wake_flags, bool *is_idle) 802 802 { 803 + if (!ops_cpu_valid(prev_cpu, NULL)) 804 + goto prev_cpu; 805 + 803 806 if (!check_builtin_idle_enabled()) 804 807 goto prev_cpu; 805 808
+10 -2
tools/sched_ext/include/scx/common.bpf.h
··· 288 288 #define bpf_obj_new(type) ((type *)bpf_obj_new_impl(bpf_core_type_id_local(type), NULL)) 289 289 #define bpf_obj_drop(kptr) bpf_obj_drop_impl(kptr, NULL) 290 290 291 - void bpf_list_push_front(struct bpf_list_head *head, struct bpf_list_node *node) __ksym; 292 - void bpf_list_push_back(struct bpf_list_head *head, struct bpf_list_node *node) __ksym; 291 + int bpf_list_push_front_impl(struct bpf_list_head *head, 292 + struct bpf_list_node *node, 293 + void *meta, __u64 off) __ksym; 294 + #define bpf_list_push_front(head, node) bpf_list_push_front_impl(head, node, NULL, 0) 295 + 296 + int bpf_list_push_back_impl(struct bpf_list_head *head, 297 + struct bpf_list_node *node, 298 + void *meta, __u64 off) __ksym; 299 + #define bpf_list_push_back(head, node) bpf_list_push_back_impl(head, node, NULL, 0) 300 + 293 301 struct bpf_list_node *bpf_list_pop_front(struct bpf_list_head *head) __ksym; 294 302 struct bpf_list_node *bpf_list_pop_back(struct bpf_list_head *head) __ksym; 295 303 struct bpf_rb_node *bpf_rbtree_remove(struct bpf_rb_root *root,
+1 -1
tools/testing/selftests/sched_ext/init_enable_count.c
··· 150 150 151 151 struct scx_test init_enable_count = { 152 152 .name = "init_enable_count", 153 - .description = "Verify we do the correct amount of counting of init, " 153 + .description = "Verify we correctly count the occurrences of init, " 154 154 "enable, etc callbacks.", 155 155 .run = run, 156 156 };
+1 -1
tools/testing/selftests/sched_ext/maybe_null.c
··· 43 43 44 44 struct scx_test maybe_null = { 45 45 .name = "maybe_null", 46 - .description = "Verify if PTR_MAYBE_NULL work for .dispatch", 46 + .description = "Verify if PTR_MAYBE_NULL works for .dispatch", 47 47 .run = run, 48 48 }; 49 49 REGISTER_SCX_TEST(&maybe_null)