Skip to content

Commit f07b806

Browse files
committed
Merge branch 'for-6.12-fixes' into for-6.13
Pull sched_ext/for-6.12-fixes to receive 0e7ffff ("scx: Fix raciness in scx_ops_bypass()"). Planned updates for scx_ops_bypass() depends on it. Signed-off-by: Tejun Heo <[email protected]>
2 parents 6d594af + a759bf0 commit f07b806

30 files changed

+302
-255
lines changed

Documentation/scheduler/sched-ext.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ BPF scheduler and reverts all tasks back to CFS.
6666
.. code-block:: none
6767
6868
# make -j16 -C tools/sched_ext
69-
# tools/sched_ext/scx_simple
69+
# tools/sched_ext/build/bin/scx_simple
7070
local=0 global=3
7171
local=5 global=24
7272
local=9 global=44

kernel/sched/core.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3518,14 +3518,16 @@ static int select_fallback_rq(int cpu, struct task_struct *p)
35183518
* The caller (fork, wakeup) owns p->pi_lock, ->cpus_ptr is stable.
35193519
*/
35203520
static inline
3521-
int select_task_rq(struct task_struct *p, int cpu, int wake_flags)
3521+
int select_task_rq(struct task_struct *p, int cpu, int *wake_flags)
35223522
{
35233523
lockdep_assert_held(&p->pi_lock);
35243524

3525-
if (p->nr_cpus_allowed > 1 && !is_migration_disabled(p))
3526-
cpu = p->sched_class->select_task_rq(p, cpu, wake_flags);
3527-
else
3525+
if (p->nr_cpus_allowed > 1 && !is_migration_disabled(p)) {
3526+
cpu = p->sched_class->select_task_rq(p, cpu, *wake_flags);
3527+
*wake_flags |= WF_RQ_SELECTED;
3528+
} else {
35283529
cpu = cpumask_any(p->cpus_ptr);
3530+
}
35293531

35303532
/*
35313533
* In order not to call set_task_cpu() on a blocking task we need
@@ -3659,6 +3661,8 @@ ttwu_do_activate(struct rq *rq, struct task_struct *p, int wake_flags,
36593661
rq->nr_uninterruptible--;
36603662

36613663
#ifdef CONFIG_SMP
3664+
if (wake_flags & WF_RQ_SELECTED)
3665+
en_flags |= ENQUEUE_RQ_SELECTED;
36623666
if (wake_flags & WF_MIGRATED)
36633667
en_flags |= ENQUEUE_MIGRATED;
36643668
else
@@ -4120,6 +4124,8 @@ int try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
41204124
guard(preempt)();
41214125
int cpu, success = 0;
41224126

4127+
wake_flags |= WF_TTWU;
4128+
41234129
if (p == current) {
41244130
/*
41254131
* We're waking current, this means 'p->on_rq' and 'task_cpu(p)
@@ -4252,7 +4258,7 @@ int try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
42524258
*/
42534259
smp_cond_load_acquire(&p->on_cpu, !VAL);
42544260

4255-
cpu = select_task_rq(p, p->wake_cpu, wake_flags | WF_TTWU);
4261+
cpu = select_task_rq(p, p->wake_cpu, &wake_flags);
42564262
if (task_cpu(p) != cpu) {
42574263
if (p->in_iowait) {
42584264
delayacct_blkio_end(p);
@@ -4793,6 +4799,7 @@ void wake_up_new_task(struct task_struct *p)
47934799
{
47944800
struct rq_flags rf;
47954801
struct rq *rq;
4802+
int wake_flags = WF_FORK;
47964803

47974804
raw_spin_lock_irqsave(&p->pi_lock, rf.flags);
47984805
WRITE_ONCE(p->__state, TASK_RUNNING);
@@ -4807,15 +4814,15 @@ void wake_up_new_task(struct task_struct *p)
48074814
*/
48084815
p->recent_used_cpu = task_cpu(p);
48094816
rseq_migrate(p);
4810-
__set_task_cpu(p, select_task_rq(p, task_cpu(p), WF_FORK));
4817+
__set_task_cpu(p, select_task_rq(p, task_cpu(p), &wake_flags));
48114818
#endif
48124819
rq = __task_rq_lock(p, &rf);
48134820
update_rq_clock(rq);
48144821
post_init_entity_util_avg(p);
48154822

48164823
activate_task(rq, p, ENQUEUE_NOCLOCK | ENQUEUE_INITIAL);
48174824
trace_sched_wakeup_new(p);
4818-
wakeup_preempt(rq, p, WF_FORK);
4825+
wakeup_preempt(rq, p, wake_flags);
48194826
#ifdef CONFIG_SMP
48204827
if (p->sched_class->task_woken) {
48214828
/*

0 commit comments

Comments
 (0)