linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: mtk.manpages@gmail.com, Dario Faggioli <raistlin@linux.it>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	rostedt@goodmis.org, Oleg Nesterov <oleg@redhat.com>,
	fweisbec@gmail.com, darren@dvhart.com, johan.eker@ericsson.com,
	p.faure@akatech.ch, Linux Kernel <linux-kernel@vger.kernel.org>,
	claudio@evidence.eu.com, michael@amarulasolutions.com,
	fchecconi@gmail.com, tommaso.cucinotta@sssup.it,
	juri.lelli@gmail.com, nicola.manica@disi.unitn.it,
	luca.abeni@unitn.it, dhaval.giani@gmail.com, hgu1972@gmail.com,
	Paul McKenney <paulmck@linux.vnet.ibm.com>,
	insop.song@gmail.com, liming.wang@windriver.com,
	jkacur@redhat.com
Subject: Re: [PATCH 01/13] sched: Add 3 new scheduler syscalls to support an extended scheduling parameters ABI
Date: Mon, 17 Feb 2014 14:20:29 +0100	[thread overview]
Message-ID: <53020C9D.1050208@gmail.com> (raw)
In-Reply-To: <20140214161929.GL27965@twins.programming.kicks-ass.net>

Hello Peter,

On 02/14/2014 05:19 PM, Peter Zijlstra wrote:
> On Fri, Feb 14, 2014 at 03:13:22PM +0100, Michael Kerrisk (man-pages) wrote:
>> Peter, Dario,
>>
>> This is a little late in the day, but I think it's an important point
>> to just check before this API goes final.
>>
>>> SYNOPSIS
>>>         #include <sched.h>
>>>
>>>         struct sched_attr {
>>>                 u32 size;
>>>
>>>                 u32 sched_policy;
>>>                 u64 sched_flags;
>> [...]
>>>         };
>>>
>>>         int sched_setattr(pid_t pid, const struct sched_attr *attr);
>>>
>>>         int sched_getattr(pid_t pid, const struct sched_attr *attr, unsigned int size);
>>
>> So, I that there's a flags field in the structure, which allows for
>> some extensibility for these calls in the future. However, is it
>> worthwhile to consider adding a 'flags' argument in the base signature
>> of either of these calls, to allow for some possible extensions in the
>> future. (See http://lwn.net/SubscriberLink/585415/7b905c0248a158a2/ ).
> 
> Sure why not.. 

Well, it doesn't need to be added gratuitously -- just if you think there's
some nonzero chance it might prove useful in the future ;-).

> I picked 'unsigned long' for the flags argument; I don't
> think there's a real standard for this, I've seen: 'int' 'unsigned int'
> and 'unsigned long' flags.
> 
> Please holler if there is indeed a preference and I picked the wrong
> one.
> 
> BTW; do you need more text on the manpage thingy I send you or was that
> sufficient?

If your could take another pass though your existing text, to incorporate the
new flags stuff, and then send a page to me + linux-man@
that would be great.

Cheers,

Michael


> ---
> Subject: sched: Add 'flags' argument to sched_{set,get}attr() syscalls
> 
> Because of a recent syscall design debate; its deemed appropriate for
> each syscall to have a flags argument for future extension; without
> immediately requiring new syscalls.
> 
> Suggested-by: Michael Kerrisk <mtk.manpages@gmail.com>
> Signed-off-by: Peter Zijlstra <peterz@infradead.org>
> ---
>  include/linux/syscalls.h |  6 ++++--
>  kernel/sched/core.c      | 11 ++++++-----
>  2 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
> index 40ed9e9a77e5..bf41aeb09078 100644
> --- a/include/linux/syscalls.h
> +++ b/include/linux/syscalls.h
> @@ -281,13 +281,15 @@ asmlinkage long sys_sched_setscheduler(pid_t pid, int policy,
>  asmlinkage long sys_sched_setparam(pid_t pid,
>  					struct sched_param __user *param);
>  asmlinkage long sys_sched_setattr(pid_t pid,
> -					struct sched_attr __user *attr);
> +					struct sched_attr __user *attr,
> +					unsigned long flags);
>  asmlinkage long sys_sched_getscheduler(pid_t pid);
>  asmlinkage long sys_sched_getparam(pid_t pid,
>  					struct sched_param __user *param);
>  asmlinkage long sys_sched_getattr(pid_t pid,
>  					struct sched_attr __user *attr,
> -					unsigned int size);
> +					unsigned int size,
> +					unsigned long flags);
>  asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,
>  					unsigned long __user *user_mask_ptr);
>  asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index fb9764fbc537..deeaa54fdf92 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -3631,13 +3631,14 @@ SYSCALL_DEFINE2(sched_setparam, pid_t, pid, struct sched_param __user *, param)
>   * @pid: the pid in question.
>   * @uattr: structure containing the extended parameters.
>   */
> -SYSCALL_DEFINE2(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr)
> +SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr,
> +			       unsigned long, flags)
>  {
>  	struct sched_attr attr;
>  	struct task_struct *p;
>  	int retval;
>  
> -	if (!uattr || pid < 0)
> +	if (!uattr || pid < 0 || flags)
>  		return -EINVAL;
>  
>  	if (sched_copy_attr(uattr, &attr))
> @@ -3774,8 +3775,8 @@ static int sched_read_attr(struct sched_attr __user *uattr,
>   * @uattr: structure containing the extended parameters.
>   * @size: sizeof(attr) for fwd/bwd comp.
>   */
> -SYSCALL_DEFINE3(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr,
> -		unsigned int, size)
> +SYSCALL_DEFINE4(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr,
> +		unsigned int, size, unsigned long, flags)
>  {
>  	struct sched_attr attr = {
>  		.size = sizeof(struct sched_attr),
> @@ -3784,7 +3785,7 @@ SYSCALL_DEFINE3(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr,
>  	int retval;
>  
>  	if (!uattr || pid < 0 || size > PAGE_SIZE ||
> -	    size < SCHED_ATTR_SIZE_VER0)
> +	    size < SCHED_ATTR_SIZE_VER0 || flags)
>  		return -EINVAL;
>  
>  	rcu_read_lock();
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

  parent reply	other threads:[~2014-02-17 13:20 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17 12:27 [PATCH 00/13] sched, deadline: patches Peter Zijlstra
2013-12-17 12:27 ` [PATCH 01/13] sched: Add 3 new scheduler syscalls to support an extended scheduling parameters ABI Peter Zijlstra
2014-01-21 14:36   ` Michael Kerrisk
2014-01-21 15:38     ` Peter Zijlstra
2014-01-21 15:46       ` Peter Zijlstra
2014-01-21 16:02         ` Steven Rostedt
2014-01-21 16:06           ` Peter Zijlstra
2014-01-21 16:46             ` Juri Lelli
2014-02-14 14:13       ` Michael Kerrisk (man-pages)
2014-02-14 16:19         ` Peter Zijlstra
2014-02-15 12:52           ` Ingo Molnar
2014-02-17 13:20           ` Michael Kerrisk (man-pages) [this message]
2014-04-09  9:25             ` sched_{set,get}attr() manpage Peter Zijlstra
2014-04-09 15:19               ` Henrik Austad
2014-04-09 15:42                 ` Peter Zijlstra
2014-04-10  7:47                   ` Juri Lelli
2014-04-10  9:59                     ` Claudio Scordino
2014-04-27 15:47                   ` Michael Kerrisk (man-pages)
2014-04-27 19:34                     ` Peter Zijlstra
2014-04-27 19:45                       ` Steven Rostedt
2014-04-28  7:39                       ` Juri Lelli
2014-04-28  8:18             ` Peter Zijlstra
2014-04-29 13:08               ` Michael Kerrisk (man-pages)
2014-04-29 14:22                 ` Peter Zijlstra
2014-04-29 16:04                 ` Peter Zijlstra
2014-04-30 11:09                   ` Michael Kerrisk (man-pages)
2014-04-30 12:35                     ` Peter Zijlstra
2014-04-30 13:09                     ` Peter Zijlstra
2014-05-03 10:43                       ` Juri Lelli
2014-05-05  6:55                         ` Michael Kerrisk (man-pages)
2014-05-05  7:21                           ` Peter Zijlstra
2014-05-05  7:41                             ` Michael Kerrisk (man-pages)
2014-05-05  7:47                               ` Peter Zijlstra
2014-05-05  9:53                                 ` Michael Kerrisk (man-pages)
2014-05-06  8:16                             ` Peter Zijlstra
2014-05-09  8:23                               ` Michael Kerrisk (man-pages)
2014-05-09  8:53                                 ` Peter Zijlstra
2014-05-09  9:26                                   ` Michael Kerrisk (man-pages)
2014-05-19 13:06                                   ` [tip:sched/core] sched: Disallow sched_attr::sched_policy < 0 tip-bot for Peter Zijlstra
2014-05-22 12:25                                   ` tip-bot for Peter Zijlstra
2014-02-21 20:32           ` [tip:sched/urgent] sched: Add 'flags' argument to sched_{set, get}attr() syscalls tip-bot for Peter Zijlstra
2014-01-26  9:48   ` [PATCH 01/13] sched: Add 3 new scheduler syscalls to support an extended scheduling parameters ABI Geert Uytterhoeven
2013-12-17 12:27 ` [PATCH 02/13] sched: SCHED_DEADLINE structures & implementation Peter Zijlstra
2013-12-17 12:27 ` [PATCH 03/13] sched: SCHED_DEADLINE SMP-related data structures & logic Peter Zijlstra
2013-12-17 12:27 ` [PATCH 04/13] [PATCH 05/13] sched: SCHED_DEADLINE avg_update accounting Peter Zijlstra
2013-12-17 12:27 ` [PATCH 05/13] sched: Add period support for -deadline tasks Peter Zijlstra
2013-12-17 12:27 ` [PATCH 06/13] [PATCH 07/13] sched: Add latency tracing " Peter Zijlstra
2013-12-17 12:27 ` [PATCH 07/13] rtmutex: Turn the plist into an rb-tree Peter Zijlstra
2013-12-17 12:27 ` [PATCH 08/13] sched: Drafted deadline inheritance logic Peter Zijlstra
2013-12-17 12:27 ` [PATCH 09/13] sched: Add bandwidth management for sched_dl Peter Zijlstra
2013-12-18 16:55   ` Peter Zijlstra
2013-12-20 17:13     ` Peter Zijlstra
2013-12-20 17:37       ` Steven Rostedt
2013-12-20 17:42         ` Peter Zijlstra
2013-12-20 18:23           ` Steven Rostedt
2013-12-20 18:26             ` Steven Rostedt
2013-12-20 21:44             ` Peter Zijlstra
2013-12-20 23:29               ` Steven Rostedt
2013-12-21 10:05                 ` Peter Zijlstra
2013-12-21 17:26                   ` Peter Zijlstra
2014-01-13 15:55       ` [tip:sched/core] sched/deadline: Fix hotplug admission control tip-bot for Peter Zijlstra
2013-12-17 12:27 ` [PATCH 10/13] sched: speed up -dl pushes with a push-heap Peter Zijlstra
2013-12-17 12:27 ` [PATCH 11/13] sched: Remove sched_setscheduler2() Peter Zijlstra
2013-12-17 12:27 ` [PATCH 12/13] sched, deadline: Fixup the smp-affinity mask tests Peter Zijlstra
2013-12-17 12:27 ` [PATCH 13/13] sched, deadline: Remove the sysctl_sched_dl knobs Peter Zijlstra
2013-12-17 20:17 ` [PATCH] sched, deadline: Properly initialize def_dl_bandwidth lock Steven Rostedt
2013-12-18 10:01   ` Peter Zijlstra
2013-12-20 13:51 ` [PATCH 00/13] sched, deadline: patches Juri Lelli
2013-12-20 14:28   ` Steven Rostedt
2013-12-20 14:51   ` Peter Zijlstra
2013-12-20 15:19     ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53020C9D.1050208@gmail.com \
    --to=mtk.manpages@gmail.com \
    --cc=claudio@evidence.eu.com \
    --cc=darren@dvhart.com \
    --cc=dhaval.giani@gmail.com \
    --cc=fchecconi@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=hgu1972@gmail.com \
    --cc=insop.song@gmail.com \
    --cc=jkacur@redhat.com \
    --cc=johan.eker@ericsson.com \
    --cc=juri.lelli@gmail.com \
    --cc=liming.wang@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.abeni@unitn.it \
    --cc=michael@amarulasolutions.com \
    --cc=mingo@redhat.com \
    --cc=nicola.manica@disi.unitn.it \
    --cc=oleg@redhat.com \
    --cc=p.faure@akatech.ch \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=raistlin@linux.it \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=tommaso.cucinotta@sssup.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).