Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 743dd30d41
Fetching contributors…

Cannot retrieve contributors at this time

73 lines (53 sloc) 2.248 kb
Timer Slack Controller
Every task_struct has timer_slack_ns value. This value is used to round
up poll() and select() timeout values. This feature can be useful in
mobile environment where combined wakeups are desired.
Originally, prctl() was the only way to change timer slack value of
a process. So you was not able change timer slack value of another
cgroup subsys "timer_slack" implements timer slack controller. It
provides a way to set minimal timer slack value for a group of tasks.
If a task belongs to a cgroup with minimal timer slack value higher than
task's value, cgroup's value will be applied.
Timer slack controller allows to implement setting timer slack value of
a process based on a policy. For example, you can create foreground and
background cgroups and move tasks between them based on system state.
User interface
To get timer slack controller functionality you need to enable it in
kernel configuration:
The controller provides two files:
# mount -t cgroup -o timer_slack none /sys/fs/cgroup
# ls /sys/fs/cgroup/timer_slack.*
By default timer_slack.min_slack_ns is 0:
# cat /sys/fs/cgroup/timer_slack.min_slack_ns
You can set it to some value:
# echo 50000 > /sys/fs/cgroup/timer_slack.min_slack_ns
# cat /sys/fs/cgroup/timer_slack.min_slack_ns
Tasks still can set task's value below 50000 using prctl(), but in this
case cgroup's value will be applied.
Timer slack controller supports hierarchical groups.
# mkdir /sys/fs/cgroup/a
# cat /sys/fs/cgroup/a/timer_slack.min_slack_ns
# echo 70000 > /sys/fs/cgroup/a/timer_slack.min_slack_ns
# cat /sys/fs/cgroup/a/timer_slack.min_slack_ns
You can set any value you want, but effective value will the highest value
up by hierarchy. You can see effective timer slack value for the cgroup from
timer_slack.effective_slack_ns file:
# cat /sys/fs/cgroup/a/timer_slack.effective_slack_ns
# echo 100000 > /sys/fs/cgroup/timer_slack.min_slack_ns
# cat /sys/fs/cgroup/a/timer_slack.min_slack_ns
# cat /sys/fs/cgroup/a/timer_slack.effective_slack_ns
Jump to Line
Something went wrong with that request. Please try again.