diff options
author | Mike Galbraith <efault@gmx.de> | 2010-11-30 08:18:03 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-11-30 10:03:35 -0500 |
commit | 5091faa449ee0b7d73bc296a93bca9540fc51d0a (patch) | |
tree | 55f5e96e189af65c85c769fce48627b8a5abb86b /init | |
parent | 822bc180a7f7a7bc5fcaaea195f41b487cc8cae8 (diff) |
sched: Add 'autogroup' scheduling feature: automated per session task groups
A recurring complaint from CFS users is that parallel kbuild has
a negative impact on desktop interactivity. This patch
implements an idea from Linus, to automatically create task
groups. Currently, only per session autogroups are implemented,
but the patch leaves the way open for enhancement.
Implementation: each task's signal struct contains an inherited
pointer to a refcounted autogroup struct containing a task group
pointer, the default for all tasks pointing to the
init_task_group. When a task calls setsid(), a new task group
is created, the process is moved into the new task group, and a
reference to the preveious task group is dropped. Child
processes inherit this task group thereafter, and increase it's
refcount. When the last thread of a process exits, the
process's reference is dropped, such that when the last process
referencing an autogroup exits, the autogroup is destroyed.
At runqueue selection time, IFF a task has no cgroup assignment,
its current autogroup is used.
Autogroup bandwidth is controllable via setting it's nice level
through the proc filesystem:
cat /proc/<pid>/autogroup
Displays the task's group and the group's nice level.
echo <nice level> > /proc/<pid>/autogroup
Sets the task group's shares to the weight of nice <level> task.
Setting nice level is rate limited for !admin users due to the
abuse risk of task group locking.
The feature is enabled from boot by default if
CONFIG_SCHED_AUTOGROUP=y is selected, but can be disabled via
the boot option noautogroup, and can also be turned on/off on
the fly via:
echo [01] > /proc/sys/kernel/sched_autogroup_enabled
... which will automatically move tasks to/from the root task group.
Signed-off-by: Mike Galbraith <efault@gmx.de>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Paul Turner <pjt@google.com>
Cc: Oleg Nesterov <oleg@redhat.com>
[ Removed the task_group_path() debug code, and fixed !EVENTFD build failure. ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <1290281700.28711.9.camel@maggy.simson.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'init')
-rw-r--r-- | init/Kconfig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/init/Kconfig b/init/Kconfig index 88c10468db46..f1bba0a1b051 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -728,6 +728,19 @@ config NET_NS | |||
728 | 728 | ||
729 | endif # NAMESPACES | 729 | endif # NAMESPACES |
730 | 730 | ||
731 | config SCHED_AUTOGROUP | ||
732 | bool "Automatic process group scheduling" | ||
733 | select EVENTFD | ||
734 | select CGROUPS | ||
735 | select CGROUP_SCHED | ||
736 | select FAIR_GROUP_SCHED | ||
737 | help | ||
738 | This option optimizes the scheduler for common desktop workloads by | ||
739 | automatically creating and populating task groups. This separation | ||
740 | of workloads isolates aggressive CPU burners (like build jobs) from | ||
741 | desktop applications. Task group autogeneration is currently based | ||
742 | upon task session. | ||
743 | |||
731 | config MM_OWNER | 744 | config MM_OWNER |
732 | bool | 745 | bool |
733 | 746 | ||