Skip to content

RFC sched: Add CPU rate caps

Peter Williams lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest5 patches 89 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5sched: Fix priority inheritence before CPU rate soft capsinclude/linux/sched.h kernel/sched.c+9 -80 replies
2/5sched: Add CPU rate soft capsinclude/linux/sched.h init/Kconfig kernel/Kconfig.caps +2 more+375 -2217 replies
3/5sched: Add CPU rate hard capsinclude/linux/sched.h kernel/Kconfig.caps kernel/sched.c+168 -850 replies
4/5sched: Add procfs interface for CPU rate soft capsfs/proc/base.c+59 -00 replies
5/5sched: Add procfs interface for CPU rate hard capsfs/proc/base.c+59 -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 0/5] sched: Add CPU rate caps

These patches implement CPU usage rate limits for tasks.

Although the rlimit mechanism already has a CPU usage limit (RLIMIT_CPU) it is a total usage limit and therefore (to my mind) not very useful. These patches provide an alternative whereby the (recent) average CPU usage rate of a task can be limited to a (per task) specified proportion of a single CPU's capacity. The limits are specified in parts per thousand and come in two varieties -- hard and soft. The difference between the two is that the system tries to enforce hard caps regardless of the other demand for CPU resources but allows soft caps to be exceeded if there are spare CPU resources available. By default, tasks will have both caps set to 1000 (i.e. no limit) but newly forked tasks will inherit any caps that have been imposed on their parent from the parent. The mimimim soft cap allowed is 0 (which effectively puts the task in the background) and the minimim hard cap allowed is 1.

Care has been taken to minimize the overhead inflicted on tasks that have no caps and my tests using kernbench indicate that it is hidden in the noise.

Note:

The first patch in this series fixes some problems with priority inheritance that are present in 2.6.17-rc4-mm3 but will be fixed in the next -mm kernel.

Signature · 4 lines
Peter Williams                                   [email protected]

"Learning, n. The kind of ignorance distinguishing the studious."
 -- Ambrose Bierce