All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Galbraith <umgwanakikbuti@gmail.com>
To: Sergey Oboguev <oboguev.public@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH RFC] sched: deferred set priority (dprio)
Date: Sun, 27 Jul 2014 06:02:15 +0200	[thread overview]
Message-ID: <1406433735.5115.38.camel@marge.simpson.net> (raw)
In-Reply-To: <CA+80gGZRxXfabODZoFMoBju=j+7+Ne8sUYaKBPzo4c9kTjL8_g@mail.gmail.com>

On Sat, 2014-07-26 at 11:30 -0700, Sergey Oboguev wrote: 
> On Sat, Jul 26, 2014 at 1:58 AM, Mike Galbraith
> <umgwanakikbuti@gmail.com> wrote:
> > On Fri, 2014-07-25 at 12:45 -0700, Sergey Oboguev wrote:
> >> [This is a repost of the message from few day ago, with patch file
> >> inline instead of being pointed by the URL.]
> >>
> >> This patch is intended to improve the support for fine-grain parallel
> >> applications that may sometimes need to change the priority of their threads at
> >> a very high rate, hundreds or even thousands of times per scheduling timeslice.
> >>
> >> These are typically applications that have to execute short or very short
> >> lock-holding critical or otherwise time-urgent sections of code at a very high
> >> frequency and need to protect these sections with "set priority" system calls,
> >> one "set priority" call to elevate current thread priority before entering the
> >> critical or time-urgent section, followed by another call to downgrade thread
> >> priority at the completion of the section. Due to the high frequency of
> >> entering and leaving critical or time-urgent sections, the cost of these "set
> >> priority" system calls may raise to a noticeable part of an application's
> >> overall expended CPU time. Proposed "deferred set priority" facility allows to
> >> largely eliminate the cost of these system calls.
> >
> > So you essentially want to ship preempt_disable() off to userspace?
> >
> 
> Only to the extent preemption control is already exported to the userspace and
> a task is already authorized to control its preemption by its RLIMIT_RTPRIO,
> RLIMIT_NICE and capable(CAP_SYS_NICE).
> 
> DPRIO does not amplify a taks's capability to elevate its priority and block
> other tasks, it just reduces the computational cost of frequest
> sched_setattr(2) calls.

Exactly.  You are abusing realtime, and you are not the only guy out
there doing that.  What you want is control over a userspace critical
section, and you are willing to do whatever is necessary to get that.  I
think your code is a really good example of how far people are willing
to go, but I hope this goes nowhere beyond getting people to think about
what you and others want.

I would say cut to the chase, if what you want/need is a privileged
userspace lock, make one, and put _all_ of the ugliness inside it.
Forget about this "Hello Mr. kernel, here's what I would have done to
get what I want if I weren't such a cheap bastard, if you think about
preempting me, pretend I actually did that instead" business.  Forget
about all that RLIMIT_RTPRIO and access list stuff too, either you're
privileged or you're not, it's not like multiple users could coexist
peacefully anyway.  Maybe you could make a flavor of futex that makes
the owner non-preemptible, checks upon release or such.

Note: if you do touch futex.c, you'll definitely want to document that
you eliminated every last remote possibility of breaking anything, and
donning Nomex underwear before posting would not be a bad idea ;-)

-Mike


  reply	other threads:[~2014-07-27  4:02 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 19:45 [PATCH RFC] sched: deferred set priority (dprio) Sergey Oboguev
2014-07-25 20:12 ` Andy Lutomirski
2014-07-26  7:56   ` Sergey Oboguev
2014-07-26  8:58 ` Mike Galbraith
2014-07-26 18:30   ` Sergey Oboguev
2014-07-27  4:02     ` Mike Galbraith [this message]
2014-07-27  9:09       ` Sergey Oboguev
2014-07-27 10:29         ` Mike Galbraith
2014-07-28  1:19 ` Andi Kleen
2014-07-28  4:16   ` Sergey Oboguev
2014-07-28  7:24   ` Mike Galbraith
2014-08-03  0:43     ` Sergey Oboguev
2014-08-03  9:56       ` Mike Galbraith
2014-08-05 23:28         ` Sergey Oboguev
2014-08-06  5:41           ` Mike Galbraith
2014-08-06  7:42             ` Mike Galbraith
2014-08-07  1:26             ` Sergey Oboguev
2014-08-07  9:03               ` Mike Galbraith
2014-08-08 20:11                 ` Sergey Oboguev
2014-08-09 13:04                   ` Mike Galbraith
2014-08-09 18:04                     ` Andi Kleen
2014-08-10  3:13                       ` Mike Galbraith
2014-08-10  3:41                         ` Mike Galbraith
2014-08-13 23:52                     ` Sergey Oboguev
2014-08-09  8:38                 ` Sergey Oboguev
2014-08-09 14:13                   ` Mike Galbraith
2014-08-03 17:30       ` Andi Kleen
2014-08-05 23:13         ` Sergey Oboguev
2014-07-30 13:02 ` Pavel Machek
2014-08-03  0:47   ` Sergey Oboguev
2014-08-03  8:30     ` Pavel Machek
2014-08-05 23:03       ` Sergey Oboguev
  -- strict thread matches above, loose matches on Subject: below --
2014-07-21 12:33 Sergey Oboguev
2014-07-21 18:14 ` Thomas Gleixner

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=1406433735.5115.38.camel@marge.simpson.net \
    --to=umgwanakikbuti@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oboguev.public@gmail.com \
    --cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.