Skip to contentSkip to conversation

sched: Remove obscure comment from select_task_rq_fair

PATCH In review Joel Fernandes (Google) 3 participants 3 messages May 28, 2018 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 sched: Remove obscure comment from select_task_rq_fair

I was playing with cpusets and sched_load_balance flag and notice that the fast-path (select_idle_sibling) can also be attempted for exec-balance, not just wake-balance if the waker cpu's cpuset has sched_load_balance = 0. This patch removes the obscure comment which was saying this path can be entered only for wake-balance.

To trigger this, I just do:
mkdir /cpuset
mount -t cpuset none /cpuset
echo 0 > sched_load_balance

Then did some random activity and dumped the stack from 'if (!sd)' for the non wake-balance cases.

Following is one of the stacks:

dump_stack+0x46/0x5b
select_task_rq_fair+0x101d/0x1030
sched_exec+0x4f/0xc0
do_execveat_common.isra.41+0x1e3/0x7c0
__x64_sys_execve+0x2d/0x40
do_syscall_64+0x43/0xf0
entry_SYSCALL_64_after_hwframe+0x44/0xa9

Turns out the same case occurs also during boot up when kthreadd tries to create threads before domains are attached so lets fix the comment.

Cc Dietmar Eggemann <[email protected]>
Cc Morten Ramussen <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Juri Lelli <[email protected]>
Cc Vincent Guittot <[email protected]>
Cc Patrick Bellasi <[email protected]>
Cc Rohit Jain <[email protected]>

---
v1->v2: Resending without "XXX" in subject since otherwise LKML thinks its junk.

 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/fair.c +1 -1
index 54dc31e7ab9b..dd07794141d0 100644
@@ -6665,7 +6665,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f
 
 	if (!sd) {
 pick_cpu:
-		if (sd_flag & SD_BALANCE_WAKE) { /* XXX always ? */
+		if (sd_flag & SD_BALANCE_WAKE) {
 			new_cpu = select_idle_sibling(p, prev_cpu, new_cpu);
 
 			if (want_affine)
Signature · 1 line
2.17.0.921.gf22659ad46-goog
maintainer
#1 lore raw
Quoted 2 lines · Joel Fernandes (Google)

This patch removes the obscure comment which was
saying this path can be entered only for wake-balance.

The comment was meant to ask if we want to always do select_idle_siblings() and not only on wakeups.

#2 lore raw
Quoted 6 lines · Peter Zijlstra
Quoted 2 lines · Joel Fernandes (Google)

This patch removes the obscure comment which was
saying this path can be entered only for wake-balance.

The comment was meant to ask if we want to always do select_idle_siblings() and not only on wakeups.

Ok, thanks for the clarification. Makes sense, and sorry for the noise.

thanks,

- Joel