BACKPORT: proc: add /proc/<pid>/timerslack_ns interface
authorJohn Stultz <john.stultz@linaro.org>
Thu, 17 Mar 2016 21:20:54 +0000 (14:20 -0700)
committerAmit Pundir <amit.pundir@linaro.org>
Mon, 11 Jul 2016 07:13:04 +0000 (12:43 +0530)
commitf431ff10d16475a860c947d23122f20656ec9bf0
tree5c13474a016efb4a3f0a6278403bacc4ba9487ac
parent7584a50e33a0cc5ad6a1fca330c99f389bab4628
BACKPORT: proc: add /proc/<pid>/timerslack_ns interface

This backports 5de23d435e88996b1efe0e2cebe242074ce67c9e

This patch provides a proc/PID/timerslack_ns interface which exposes a
task's timerslack value in nanoseconds and allows it to be changed.

This allows power/performance management software to set timer slack for
other threads according to its policy for the thread (such as when the
thread is designated foreground vs.  background activity)

If the value written is non-zero, slack is set to that value.  Otherwise
sets it to the default for the thread.

This interface checks that the calling task has permissions to to use
PTRACE_MODE_ATTACH_FSCREDS on the target task, so that we can ensure
arbitrary apps do not change the timer slack for other apps.

Signed-off-by: John Stultz <john.stultz@linaro.org>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Oren Laadan <orenl@cellrox.com>
Cc: Ruchi Kandoi <kandoiruchi@google.com>
Cc: Rom Lemarchand <romlem@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Documentation/filesystems/proc.txt
fs/proc/base.c