mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Sergey Oboguev <oboguev.public@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] sched: deferred set priority (dprio)
Date: Sun, 3 Aug 2014 10:30:06 +0200	[thread overview]
Message-ID: <20140803083006.GA1758@amd.pavel.ucw.cz> (raw)
In-Reply-To: <CA+80gGbOx9istV4UG7PF+qam81u+HzJyjznE5sjVV82jjWa=MQ@mail.gmail.com>

On Sat 2014-08-02 17:47:52, Sergey Oboguev wrote:
> On Wed, Jul 30, 2014 at 6:02 AM, Pavel Machek <pavel@ucw.cz> wrote:
> > Hi!
> >
> >> One of the intended purposes of this facility (but its not sole purpose) is to
> >> render a lightweight mechanism for priority protection of lock-holding critical
> >> sections that would be an adequate match for lightweight locking primitives
> >> such as futex, with both featuring a fast path completing within the
> >> userspace.
> 
> > Do we get a manpage describing the interface...?
> 
> At this point it is just an RFC, and the only available write-up is an article
> (URL is in the original message).
> 
> There has been no word from the maintainers yet whether the proposal appears
> to be a "go" or "no-go" in general.

It appears to be "no-go" to me.

> Regular "set priority" cannot be wrapped around "deferred set priority".

Umm. Why not?

int getpriority(int which, int who);
int setpriority(int which, int who, int prio);

Description


 The scheduling priority of the process, process group, or user, as
 indicated by which and who is obtained with the getpriority() call
 and set with the setpriority() call.
The value which is one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER, and
 who is interpreted relative to which (a process identifier for
 PRIO_PROCESS, process group identifier for PRIO_PGRP, and a user ID
 for PRIO_USER). A zero value for who denotes (respectively) the
 calling process, the process group of the calling process, or the
 real user ID of the calling process. Prio is a value in the range -20
 to 19 (but see the Notes below). The default priority is 0; lower
 priorities cause more favorable scheduling.

In vsyscall area:

   if (which==PRIO_PROCESS && who==0) {
      perform your optimized priority set
   } else {
      perform syscall
}

Now, you have to make sure to keep reasonably close semantics, but
that would be good idea, anyway.
   
> Even more importantly, its use also relies on a thread caching the application's
> current knowledge of the thread priority in the userspace, and if the thread
> priority had been changed from the outside of the application (or even by
> another thread within the same application), this knowledge becomes invalid,
> and then the application is responsible for performing whatever recovery action
> is appropriate.

You mean "we rely on applications handling the situation they can't
and will not handle"?

Actually, it seems to be a security issue to me.

If root renices the application to high nice value, application should
not be able to work around it by the DPRIO interface.

IOW the priority should be always the lower of DPRIO and normal one,
at the very least.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2014-08-03  8:30 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 19:45 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
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 [this message]
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=20140803083006.GA1758@amd.pavel.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oboguev.public@gmail.com \
    /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®