cgroup/freezer: add per freezer duty ratio control
PATCH v8 1/1 cgroup/freezer: add per freezer duty ratio control
From: Jacob Pan <[email protected]>
Freezer subsystem is used to manage batch jobs which can start stop at the same time. However, sometime it is desirable to let the kernel manage the freezer state automatically with a given duty ratio.
For example, if we want to reduce the time that backgroup apps are allowed to run we can put them into a freezer subsystem and set the kernel to turn them THAWED/FROZEN at given duty ratio.
This patch introduces two file nodes under cgroup
freezer.duty_ratio_pct and freezer.period_sec
Usage example: set period to be 5 seconds and frozen duty ratio 90% [root@localhost aoa]# echo 90 > freezer.duty_ratio_pct [root@localhost aoa]# echo 5000 > freezer.period_ms
--- Documentation/cgroups/freezer-subsystem.txt | 23 ++++ kernel/cgroup_freezer.c | 146 ++++++++++++++++++++++++++- 2 files changed, 167 insertions(+), 2 deletions(-)
Documentation/cgroups/freezer-subsystem.txt +23 -0
@@ -100,3 +100,26 @@ things happens: and returns EINVAL) 3) The tasks that blocked the cgroup from entering the "FROZEN" state disappear from the cgroup's set of tasks. + +In embedded systems, it is desirable to manage group of applications +for power saving. E.g. tasks that are not in the foreground may be +frozen and unfrozen periodically to save power without affecting user +experience. In this case, user/management software can attach tasks +into freezer cgroup then specify duty ratio and period that the +managed tasks are allowed to run. + +Usage example: +Assuming freezer cgroup is already mounted, application being managed +are included the "tasks" file node of the given freezer cgroup. +To make the tasks frozen at 90% of the time every 5 seconds, do: + +[root@localhost ]# echo 90 > freezer.duty_ratio_pct +[root@localhost ]# echo 5000 > freezer.period_ms + +After that, the application in this freezer cgroup will only be +allowed to run at the following pattern. + __ __ __ + | |<-- 90% frozen -->| | | | +____| |__________________| |__________________| |_____ + + |<---- 5 seconds ---->|
kernel/cgroup_freezer.c +144 -2
200 lines not on this page · raw message
Signature · 1 line
1.7.0.4