From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755330AbcBEUcc (ORCPT ); Fri, 5 Feb 2016 15:32:32 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:36981 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751425AbcBEUcb (ORCPT ); Fri, 5 Feb 2016 15:32:31 -0500 Date: Fri, 5 Feb 2016 12:32:30 -0800 From: Andrew Morton To: John Stultz Cc: lkml , Ruchi Kandoi , Arjan van de Ven , Thomas Gleixner , Oren Laadan , Rom Lemarchand , Kees Cook , Android Kernel Team Subject: Re: [PATCH] prctl: Add PR_SET_TIMERSLACK_PID for setting timer slack of an arbitrary thread. Message-Id: <20160205123230.bd8bd228a0f3798a281266eb@linux-foundation.org> In-Reply-To: References: <1454695723-4393-1-git-send-email-john.stultz@linaro.org> <20160205121353.63d65c6b33a153bd9f863d8b@linux-foundation.org> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 5 Feb 2016 12:23:13 -0800 John Stultz wrote: > On Fri, Feb 5, 2016 at 12:13 PM, Andrew Morton > wrote: > > On Fri, 5 Feb 2016 10:08:43 -0800 John Stultz 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? A syscall is quite a bit more fuss - implement it on x86_64, provide a no-op default in sys_ni.c, add a test suite into tools/testing/selftests (mainly for arch maintainers), wait for the various arch maintainers to wire it up. Fortunately the build system now emits little messages which tell maintainers that there's a new syscall which needs looking at. And a manpage will be needed, but a prctl manpage patch would have been needed anyway.