Skip to content

sched: tasklist_lock cleanups (Was: don't use while_each_thread())

Oleg Nesterov lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2sched: normalize_rt_tasks: don't use _irqsave for tasklist_lock, use task_rq_lock()kernel/sched/core.c+6 -100 replies
2/2sched: print_rq: don't use tasklist_lockkernel/sched/debug.c+2 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] sched: tasklist_lock cleanups (Was: don't use while_each_thread())
Quoted 8 lines · Oleg Nesterov

Peter, could you take these simple patches ?

Better later than never... per-file, but please feel free to join them in a single patch.

read_lock_irq*(tasklist_lock) in kernel/sched/ files looks strange. Why? I'll recheck, but this looks unneeded.

Yes, please consider these minor cleanups on top of for_each_thread conversions.

read_lock_irq(tasklist) in normalize_rt_tasks() doesn't really hurt, but it looks confusing. If we really have a reason to disable irqs this (subtle) reason should be documented.

And I can't understand tg_has_rt_tasks(). Don't we need something like the patch below? If not, please do not ask me why I think so, I don't understand this black magic ;) But the usage of the global "runqueues" array looks suspicious.

Oleg.

kernel/sched/core.c +1 -1
@@ -7354,7 +7354,7 @@ static inline int tg_has_rt_tasks(struct
 	struct task_struct *g, *p;
 
 	for_each_process_thread(g, p) {
-		if (rt_task(p) && task_rq(p)->rt.tg == tg)
+		if (rt_task(p) && task_group(p) == tg)
 			return 1;
 	}