Skip to content

Commit 7839932

Browse files
committed
Merge tag 'sched_ext-for-6.19-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext
Pull sched_ext fixes from Tejun Heo: - Fix uninitialized @ret on alloc_percpu() failure leading to ERR_PTR(0) - Fix PREEMPT_RT warning when bypass load balancer sends IPI to offline CPU by using resched_cpu() instead of resched_curr() - Fix comment referring to renamed function - Update scx_show_state.py for scx_root and scx_aborting changes * tag 'sched_ext-for-6.19-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext: tools/sched_ext: update scx_show_state.py for scx_aborting change tools/sched_ext: fix scx_show_state.py for scx_root change sched_ext: Use the resched_cpu() to replace resched_curr() in the bypass_lb_node() sched_ext: Fix some comments in ext.c sched_ext: fix uninitialized ret on alloc_percpu() failure
2 parents bba0b6a + c9894e6 commit 7839932

2 files changed

Lines changed: 16 additions & 17 deletions

File tree

kernel/sched/ext.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,7 @@ static bool dequeue_task_scx(struct rq *rq, struct task_struct *p, int deq_flags
15771577
*
15781578
* @p may go through multiple stopping <-> running transitions between
15791579
* here and put_prev_task_scx() if task attribute changes occur while
1580-
* balance_scx() leaves @rq unlocked. However, they don't contain any
1580+
* balance_one() leaves @rq unlocked. However, they don't contain any
15811581
* information meaningful to the BPF scheduler and can be suppressed by
15821582
* skipping the callbacks if the task is !QUEUED.
15831583
*/
@@ -2372,7 +2372,7 @@ static void switch_class(struct rq *rq, struct task_struct *next)
23722372
* preempted, and it regaining control of the CPU.
23732373
*
23742374
* ->cpu_release() complements ->cpu_acquire(), which is emitted the
2375-
* next time that balance_scx() is invoked.
2375+
* next time that balance_one() is invoked.
23762376
*/
23772377
if (!rq->scx.cpu_released) {
23782378
if (SCX_HAS_OP(sch, cpu_release)) {
@@ -2478,7 +2478,7 @@ do_pick_task_scx(struct rq *rq, struct rq_flags *rf, bool force_scx)
24782478
}
24792479

24802480
/*
2481-
* If balance_scx() is telling us to keep running @prev, replenish slice
2481+
* If balance_one() is telling us to keep running @prev, replenish slice
24822482
* if necessary and keep running @prev. Otherwise, pop the first one
24832483
* from the local DSQ.
24842484
*/
@@ -3956,13 +3956,8 @@ static void bypass_lb_node(struct scx_sched *sch, int node)
39563956
nr_donor_target, nr_target);
39573957
}
39583958

3959-
for_each_cpu(cpu, resched_mask) {
3960-
struct rq *rq = cpu_rq(cpu);
3961-
3962-
raw_spin_rq_lock_irq(rq);
3963-
resched_curr(rq);
3964-
raw_spin_rq_unlock_irq(rq);
3965-
}
3959+
for_each_cpu(cpu, resched_mask)
3960+
resched_cpu(cpu);
39663961

39673962
for_each_cpu_and(cpu, cpu_online_mask, node_mask) {
39683963
u32 nr = READ_ONCE(cpu_rq(cpu)->scx.bypass_dsq.nr);
@@ -4025,7 +4020,7 @@ static DEFINE_TIMER(scx_bypass_lb_timer, scx_bypass_lb_timerfn);
40254020
*
40264021
* - ops.dispatch() is ignored.
40274022
*
4028-
* - balance_scx() does not set %SCX_RQ_BAL_KEEP on non-zero slice as slice
4023+
* - balance_one() does not set %SCX_RQ_BAL_KEEP on non-zero slice as slice
40294024
* can't be trusted. Whenever a tick triggers, the running task is rotated to
40304025
* the tail of the queue with core_sched_at touched.
40314026
*
@@ -4783,8 +4778,10 @@ static struct scx_sched *scx_alloc_and_add_sched(struct sched_ext_ops *ops)
47834778
}
47844779

47854780
sch->pcpu = alloc_percpu(struct scx_sched_pcpu);
4786-
if (!sch->pcpu)
4781+
if (!sch->pcpu) {
4782+
ret = -ENOMEM;
47874783
goto err_free_gdsqs;
4784+
}
47884785

47894786
sch->helper = kthread_run_worker(0, "sched_ext_helper");
47904787
if (IS_ERR(sch->helper)) {
@@ -6067,7 +6064,7 @@ __bpf_kfunc bool scx_bpf_dsq_move_to_local(u64 dsq_id)
60676064
/*
60686065
* A successfully consumed task can be dequeued before it starts
60696066
* running while the CPU is trying to migrate other dispatched
6070-
* tasks. Bump nr_tasks to tell balance_scx() to retry on empty
6067+
* tasks. Bump nr_tasks to tell balance_one() to retry on empty
60716068
* local DSQ.
60726069
*/
60736070
dspc->nr_tasks++;

tools/sched_ext/scx_show_state.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@ def read_static_key(name):
2727
def state_str(state):
2828
return prog['scx_enable_state_str'][state].string_().decode()
2929

30-
ops = prog['scx_ops']
30+
root = prog['scx_root']
3131
enable_state = read_atomic("scx_enable_state_var")
3232

33-
print(f'ops : {ops.name.string_().decode()}')
33+
if root:
34+
print(f'ops : {root.ops.name.string_().decode()}')
35+
else:
36+
print('ops : ')
3437
print(f'enabled : {read_static_key("__scx_enabled")}')
3538
print(f'switching_all : {read_int("scx_switching_all")}')
3639
print(f'switched_all : {read_static_key("__scx_switched_all")}')
3740
print(f'enable_state : {state_str(enable_state)} ({enable_state})')
38-
print(f'in_softlockup : {prog["scx_in_softlockup"].value_()}')
39-
print(f'breather_depth: {read_atomic("scx_breather_depth")}')
41+
print(f'aborting : {prog["scx_aborting"].value_()}')
4042
print(f'bypass_depth : {prog["scx_bypass_depth"].value_()}')
4143
print(f'nr_rejected : {read_atomic("scx_nr_rejected")}')
4244
print(f'enable_seq : {read_atomic("scx_enable_seq")}')

0 commit comments

Comments
 (0)