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

From: John Stultz
Date: Fri Feb 05 2016 - 15:23:40 EST


On Fri, Feb 5, 2016 at 12:13 PM, Andrew Morton
<akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, 5 Feb 2016 10:08:43 -0800 John Stultz <john.stultz@xxxxxxxxxx> wrote:
>> @@ -2218,6 +2222,27 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
>> case PR_GET_TID_ADDRESS:
>> error = prctl_get_tid_address(me, (int __user **)arg2);
>> break;
>> + case PR_SET_TIMERSLACK_PID:
>> + rcu_read_lock();
>> + tsk = find_task_by_vpid((pid_t)arg3);
>
> hm, as far as I can tell this is the first instance in which prctl() is
> used to play with a task other than "current". Maybe this isn't a good
> precedent.
>
> If you look at all the other diddle-other-task functions in
> kernel/sys.c, you'll see that they are standalone syscalls. What
> you've done here is just a bit lazy: added what is effectively a new
> standalone syscall, only it has been hidden within the prctl() switch
> statement.
>
> I don't see a practical problem with this - we could have implemented
> all those other syscalls as prctl submodes as well. But we didn't...
>
> IOW, it would be more consistent to add sys_set_timer_slack()?

I'm fine with moving this way.

Ruchi/Rom: Any objections to that idea?

Thomas/Arjan: Any other functionality we should consider including
when adding a syscall to tweak timer slack?

thanks
-john