Skip to content

RFC sched: dynamically adapt granularity with nr_running

Mathieu Desnoyers lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 56 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2sched: dynamically adapt granularity with nr_runningkernel/sched_debug.c kernel/sched_fair.c+30 -1072 replies
2/2sched: sleepers coarse granularity on wakeupinclude/linux/sched.h kernel/sched.c kernel/sched_debug.c +1 more+14 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [RFC patch 0/2] sched: dynamically adapt granularity with nr_running

Changing the minimum granularity is a double-edged sword: if we set it to a too small value, then the scheduler will preempt tasks too often. If it is too large, then the "latency" period can grow very large as the number of running tasks increases.

The first patch leaves the same scheduling granularity when there are few tasks on the system (3 or less), but dynamically adapts (shrinks) the sched granularity when there are more. At a ceiling value of 8 running tasks (this choice is arbitrary), it grows the latency rather than shrinking granularity further to ensure we don't end up calling the scheduler too often.

The second patch ensures that awakened sleeping tasks don't get affected by shrinked minimum granularity.

Comments are welcome,

Thanks,

Mathieu

Signature · 4 lines
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com