Re: [PATCH] prctl: Add PR_SET_TIMERSLACK_PID for setting timer slack of an arbitrary thread.

From: Arjan van de Ven
Date: Fri Feb 05 2016 - 21:16:38 EST


On 2/5/2016 4:51 PM, John Stultz wrote:
On Fri, Feb 5, 2016 at 2:35 PM, John Stultz <john.stultz@xxxxxxxxxx> wrote:
On Fri, Feb 5, 2016 at 12:50 PM, Andrew Morton
<akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
On Fri, 5 Feb 2016 12:44:04 -0800 Kees Cook <keescook@xxxxxxxxxxxx> wrote:
Could this be exposed as a writable /proc entry instead? Like the oom_* stuff?

/proc/<pid>/timer_slack_ns, guarded by ptrace_may_access(), documented
under Documentation/? Yup, that would work. It's there for all
architectures from day one and there is precedent. It's not as nice,
but /proc nasties will always be with us.

Ok. I'll start working on that.

Arjan/Thomas: One curious thing I noticed here while writing some
documentation. The timer_slack_ns value in the task struct is a
unsigned long.

So this means PR_SET_TIMERSLACK limits the maximum slack on 32 bit
machines to ~4 seconds. Where on 64bit machines it can be quite a bit
longer (unreasonably long, really :).

originally when we created timerslack, 4 seconds was an eternity and good enough for everyone
by a mile... (assumption was practical upper limit being in the 15 msec range)
and most of the RT guys would only tolerate a little bit of it

is there any real/practial use of going longer than 4 seconds? if there
is then yeah fixing it makes sense.
if it's just theoretical... shrug... 32 bit systems have a bunch of
other limits/differences a well.