mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: chris hyser <chris.hyser@oracle.com>
To: Qais Yousef <qais.yousef@arm.com>
Cc: Parth Shah <parth@linux.ibm.com>,
	vincent.guittot@linaro.org, patrick.bellasi@matbug.net,
	valentin.schneider@arm.com, dhaval.giani@oracle.com,
	dietmar.eggemann@arm.com, linux-kernel@vger.kernel.org,
	peterz@infradead.org, mingo@redhat.com, pavel@ucw.cz,
	qperret@qperret.net, David.Laight@ACULAB.COM, pjt@google.com,
	tj@kernel.org
Subject: Re: [PATCH v3 0/3] Introduce per-task latency_nice for scheduler hints
Date: Thu, 20 Feb 2020 11:34:57 -0500	[thread overview]
Message-ID: <9bb1437b-3de0-b0ca-6319-6be903b0758d@oracle.com> (raw)
In-Reply-To: <20200220150343.dvweamfnk257pg7z@e107158-lin.cambridge.arm.com>

On 2/20/20 10:03 AM, Qais Yousef wrote:
> On 02/20/20 09:30, chris hyser wrote:
>>> The below diff works out well enough in-order to align permission checks
>>> with NICE.
>>>
>>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>>> index 2bfcff5623f9..ef4a397c9170 100644
>>> --- a/kernel/sched/core.c
>>> +++ b/kernel/sched/core.c
>>> @@ -4878,6 +4878,10 @@ static int __sched_setscheduler(struct task_struct *p,
>>>                           return -EINVAL;
>>>                   if (attr->sched_latency_nice < MIN_LATENCY_NICE)
>>>                           return -EINVAL;
>>> +               /* Use the same security checks as NICE */
>>> +               if (attr->sched_latency_nice < p->latency_nice &&
>>> +                   !can_nice(p, attr->sched_latency_nice))
>>> +                       return -EPERM;
>>>           }
>>>
>>>           if (pi)
>>>
>>> With the above in effect,
>>> A non-root user can only increase the value upto +19, and once increased
>>> cannot be decreased. e.g., a user once sets the value latency_nice = 19,
>>> the same user cannot set the value latency_nice = 18. This is the same
>>> effect as with NICE.
>>>
>>> Is such permission checks required?
>>>
>>> Unlike NICE, we are going to use latency_nice for scheduler hints only, and
>>> so won't it make more sense to allow a user to increase/decrease the values
>>> of their owned tasks?
>>
>> Whether called a hint or not, it is a trade-off to reduce latency of select
>> tasks at the expense of the throughput of the other tasks in the the system.
> 
> Does it actually affect the throughput of the other tasks? I thought this will
> allow the scheduler to reduce latencies, for instance, when selecting which cpu
> it should land on. I can't see how this could hurt other tasks.

This is why it is hard to argue about pure abstractions. The primary idea mentioned so far for how these latencies are 
reduced is by short cutting the brute-force search for something idle. If you don't find an idle cpu because you didn't 
spend the time to look, then you pre-empted a task, possibly with a large nice warm cache footprint that was cranking 
away on throughput. It is ultimately going to be the usual latency vs throughput trade off. If latency reduction were 
"free" we wouldn't need a per task attribute. We would just do the reduction for all tasks, everywhere, all the time.

> 
> Can you expand on the scenario you have in mind please?

Hopefully, the above helps. It was my original plan to introduce this with a data laden RFC on the topic, but I felt the 
need to respond to Parth immediately. I'm not currently pushing any particular change.

-chrish

  reply	other threads:[~2020-02-20 16:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-16 12:02 Parth Shah
2020-01-16 12:02 ` [PATCH v3 1/3] sched: Introduce latency-nice as a per-task attribute Parth Shah
2020-01-16 12:02 ` [PATCH v3 2/3] sched/core: Propagate parent task's latency requirements to the child task Parth Shah
2020-01-16 12:02 ` [PATCH v3 3/3] sched: Allow sched_{get,set}attr to change latency_nice of the task Parth Shah
2020-02-17  8:57 ` [PATCH v3 0/3] Introduce per-task latency_nice for scheduler hints Parth Shah
2020-02-18 23:00   ` chris hyser
2020-02-19 10:09     ` Parth Shah
2020-02-19 14:15       ` chris hyser
2020-02-19 18:23         ` chris hyser
2020-02-20  8:34           ` Parth Shah
2020-02-20  8:50             ` Parth Shah
2020-02-20 14:30               ` chris hyser
2020-02-20 15:03                 ` Qais Yousef
2020-02-20 16:34                   ` chris hyser [this message]
2020-02-21  9:29                     ` Qais Yousef
2020-02-21 10:01                       ` Parth Shah
2020-02-21 16:51                         ` chris hyser
2020-02-21 17:08                       ` chris hyser
2020-02-21 17:52       ` chris hyser
2020-02-19 11:18     ` David Laight
2020-02-19 17:16       ` chris hyser
2020-02-20 14:39         ` David Laight
2020-02-20 15:55           ` chris hyser

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=9bb1437b-3de0-b0ca-6319-6be903b0758d@oracle.com \
    --to=chris.hyser@oracle.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=dhaval.giani@oracle.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=parth@linux.ibm.com \
    --cc=patrick.bellasi@matbug.net \
    --cc=pavel@ucw.cz \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=qais.yousef@arm.com \
    --cc=qperret@qperret.net \
    --cc=tj@kernel.org \
    --cc=valentin.schneider@arm.com \
    --cc=vincent.guittot@linaro.org \
    /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

all inboxes | Powered by JetHome®