Posted Oct 18, 2007 9:45 UTC (Thu) by mingo
Parent article: Merged for 2.6.24
The CFS group scheduling code has been merged. There is also a mechanism for per-UID group scheduling. As of this writing, though, the feature cannot actually be turned on because the control groups code has not yet been merged.
Small correction: it can already be turned on via the CONFIG_FAIR_GROUP_SCHED=y config option - this is a feature that has been added recently.
With this feature enabled the kernel will schedule based on UIDs too: if one user runs 500 tasks and the other user runs only 2 tasks, the two users will still share the CPU(s) fairly, with both getting 50% of CPU time. (I have also tested this with fork bombs: if a user is running a fork bomb then other users are not affected at all [CPU scheduling wise], and the admin can log in and disable the user as well.)
The scheduling weight of each UID defaults to 100%, and it can be dynamically reconfigured via sysfs: /sys/kernel/uid/*/cpu_share - a value of 1024 means 100% weight. So by echoing 2048 into that file a user will get twice as much CPU time as a user who has 1024 cpu_share value.
An additional mechanism is that uevents can be used to configure UIDs as they get created. None of this needs the control groups / containers APIs.
to post comments)