Files
ubports_kernel_google_msm/include/linux
Lennart Poettering ca94c44253 sched: Introduce SCHED_RESET_ON_FORK scheduling policy flag
This patch introduces a new flag SCHED_RESET_ON_FORK which can be passed
to the kernel via sched_setscheduler(), ORed in the policy parameter. If
set this will make sure that when the process forks a) the scheduling
priority is reset to DEFAULT_PRIO if it was higher and b) the scheduling
policy is reset to SCHED_NORMAL if it was either SCHED_FIFO or SCHED_RR.

Why have this?

Currently, if a process is real-time scheduled this will 'leak' to all
its child processes. For security reasons it is often (always?) a good
idea to make sure that if a process acquires RT scheduling this is
confined to this process and only this process. More specifically this
makes the per-process resource limit RLIMIT_RTTIME useful for security
purposes, because it makes it impossible to use a fork bomb to
circumvent the per-process RLIMIT_RTTIME accounting.

This feature is also useful for tools like 'renice' which can then
change the nice level of a process without having this spill to all its
child processes.

Why expose this via sched_setscheduler() and not other syscalls such as
prctl() or sched_setparam()?

prctl() does not take a pid parameter. Due to that it would be
impossible to modify this flag for other processes than the current one.

The struct passed to sched_setparam() can unfortunately not be extended
without breaking compatibility, since sched_setparam() lacks a size
parameter.

How to use this from userspace? In your RT program simply replace this:

  sched_setscheduler(pid, SCHED_FIFO, &param);

by this:

  sched_setscheduler(pid, SCHED_FIFO|SCHED_RESET_ON_FORK, &param);

Signed-off-by: Lennart Poettering <lennart@poettering.net>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20090615152714.GA29092@tango.0pointer.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-06-15 17:31:59 +02:00
..
2009-06-11 21:36:00 -04:00
2009-06-01 06:21:13 +00:00
2009-05-02 15:36:10 -07:00
2009-04-23 10:06:35 +01:00
2009-06-11 21:36:09 -04:00
2009-05-29 08:40:01 -07:00
2009-06-11 08:50:57 -07:00
2009-06-11 21:36:06 -04:00
2009-06-11 21:36:11 -04:00
2009-05-22 09:43:41 +10:00
2009-06-14 22:10:41 +02:00
2009-06-11 21:36:12 -04:00
2009-06-11 17:03:28 +01:00
2009-06-10 11:48:39 +03:00
2009-04-28 07:37:28 +02:00
2009-06-11 21:36:02 -04:00
2009-06-11 21:36:01 -04:00
2009-04-30 15:32:11 +00:00
2009-04-24 08:54:21 +02:00
2009-06-11 21:36:12 -04:00
2009-05-09 10:49:41 -04:00
2009-06-11 08:50:58 -07:00
2009-05-12 11:11:48 +02:00
2009-06-11 08:50:59 -07:00
2009-06-11 08:51:01 -07:00