LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Michael Kerrisk" <mtk.manpages@googlemail.com>
To: "Peter Zijlstra" <a.p.zijlstra@chello.nl>
Cc: "Ingo Molnar" <mingo@elte.hu>, "Arnd Bergmann" <arnd@arndb.de>,
	"Christoph Hellwig" <hch@lst.de>,
	cbe-oss-dev@ozlabs.org, "Jeremy Kerr" <jk@ozlabs.org>,
	linux-kernel@vger.kernel.org
Subject: Re: SCHED_IDLE documentation
Date: Wed, 5 Mar 2008 16:19:01 +0100	[thread overview]
Message-ID: <cfd18e0f0803050719y274d8b48r9dc2dcc0f9179e3c@mail.gmail.com> (raw)
In-Reply-To: <1204629104.6241.49.camel@lappy>

On Tue, Mar 4, 2008 at 12:11 PM, Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
>
>
>  On Mon, 2008-03-03 at 15:06 +0100, Michael Kerrisk wrote:
>  > Ingo,
>  >
>  > On Mon, Mar 3, 2008 at 1:52 PM, Ingo Molnar <mingo@elte.hu> wrote:
>  > >
>  > >  * Michael Kerrisk <mtk.manpages@googlemail.com> wrote:
>  > >
>  > >
>  > > > > > * What's the difference between SCHED_IDLE and SCHED_BATCH?
>  > >  > >
>  > >  > > SCHED_BATCH can still have nice levels from -20 to +19, it is a
>  > >  > > modified SCHED_OTHER/SCHED_NORMAL for "throughput oriented"
>  > >  > > workloads.
>  > >  >
>  > >  > So, suppose we have two CPU intensive jobs, one SCHED_OTHER and the
>  > >  > other SCHED_BATCH.  If they have the same nice value, will/should the
>  > >  > scheduler favour one over the other?
>  > >
>  > >  yes - SCHED_BATCH does not modify the CPU usage proportion for
>  > >  CPU-intense tasks, it's their nice value that controls the proportion.
>  > >  What it will influence is wakeup behavior - i.e. wakeup-intense
>  > >  workloads should schedule less with SCHED_BATCH. (but how that is done
>  > >  is really fluid and will probably tweaked in the future.)
>  > >
>  > >         Ingo
>  >
>  > So, I've tweaked the description of SCHED_BATCH in the
>  > sched_setscheduler.2 man page, and added some text describing
>  > SCHED_IDLE.  Relevant excepts below.  Does his look okay to you?
>  >
>  >        SCHED_OTHER is the default universal time-sharing  sched-
>  >        uler  policy  used  by  most  processes.   SCHED_BATCH is
>  >        intended  for  "batch"  style  execution  of   processes.
>  >        SCHED_IDLE  is  intended  for  running  very low priority
>  >        background jobs.  SCHED_FIFO and  SCHED_RR  are  intended
>  >        for  special time-critical applications that need precise
>  >        control over the way  in  which  runnable  processes  are
>  >        selected for execution.
>  >
>  >        Processes  scheduled  with  SCHED_OTHER,  SCHED_BATCH, or
>  >        SCHED_IDLE must be assigned the static priority 0.   Pro-
>  >        cesses  scheduled under SCHED_FIFO or SCHED_RR can have a
>  >        static priority in the range 1 to 99.
>  >        ...
>  >
>  >    SCHED_BATCH: Scheduling batch processes
>  >        (Since Linux 2.6.16.)  SCHED_BATCH can only  be  used  at
>  >        static   priority   0.    This   policy   is  similar  to
>  >        SCHED_OTHER, except that it will cause the  scheduler  to
>  >        always  assume that the process is CPU-intensive.  Conse-
>  >        quently, the scheduler  will  apply  a  small  scheduling
>  >        penalty  with  respect  to wakeup behaviour, so that this
>  >        process is mildly  disfavored  in  scheduling  decisions.
>  >        This policy is useful for workloads that are non-interac-
>  >        tive, but do not want to lower their nice value, and  for
>  >        workloads  that  want  a  deterministic scheduling policy
>  >        without interactivity causing extra preemptions  (between
>  >        the workload's tasks).
>  >
>  >    SCHED_IDLE: Scheduling very low priority jobs
>  >        (Since  Linux  2.6.23.)   SCHED_IDLE  can only be used at
>  >        static priority 0; the process nice value has  no  influ-
>  >        ence  for  this policy.  This policy is intended for run-
>  >        ning jobs at extremely low priority (lower  even  than  a
>  >        +19  nice value with the SCHED_OTHER or SCHED_BATCH poli-
>  >        cies).
>
>  Your SCHED_BATCH and SCHED_IDLE descriptions seem at odds, in that your
>  SCHED_IDLE description says you can run SCHED_BATCH +19, however your
>  SCHED_BATCH description says you can only run at nice 0.
>
>  To clarify SCHED_BATCH _can_ indeed use the full nice range.

Peter,

The problem is that the page is slightly confusing in that it talks
about two different types of priorities:

"static priorities" which can only be non-zero (1 to 99) for RR and
FIFO policies.

"dynamic priorities" (aka "nice value") which can be (in userspace) -20 to +19.

I tweaked the wording in the description of SCHED_BATCH a little to
make this clearer.

Thanks,

Michael

-- 
Michael Kerrisk
Maintainer of the Linux man-pages project
http://www.kernel.org/doc/man-pages/
Want to report a man-pages bug?  Look here:
http://www.kernel.org/doc/man-pages/reporting_bugs.html

  reply	other threads:[~2008-03-05 15:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1203376368.275756.252634247263.1.gpush@pokey>
     [not found] ` <200803030612.28039.arnd@arndb.de>
     [not found]   ` <20080303051719.GA26102@lst.de>
2008-03-03  6:21     ` Arnd Bergmann
2008-03-03  7:33       ` Ingo Molnar
2008-03-03  8:40         ` Michael Kerrisk
2008-03-03  9:24           ` Ingo Molnar
2008-03-03  9:31             ` Arnd Bergmann
2008-03-03 10:03               ` Michael Kerrisk
2008-03-03 10:04               ` Ingo Molnar
2008-03-03 10:12                 ` Michael Kerrisk
2008-03-03 10:07             ` Michael Kerrisk
2008-03-03 10:17               ` Ingo Molnar
2008-03-03 10:20                 ` Michael Kerrisk
2008-03-03 12:31             ` Michael Kerrisk
2008-03-03 12:52               ` Ingo Molnar
2008-03-03 14:06                 ` Michael Kerrisk
2008-03-04 11:11                   ` Peter Zijlstra
2008-03-05 15:19                     ` Michael Kerrisk [this message]
2008-03-03 14:42                 ` Michael Kerrisk
2008-03-05 15:02                   ` Michael Kerrisk

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=cfd18e0f0803050719y274d8b48r9dc2dcc0f9179e3c@mail.gmail.com \
    --to=mtk.manpages@googlemail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=arnd@arndb.de \
    --cc=cbe-oss-dev@ozlabs.org \
    --cc=hch@lst.de \
    --cc=jk@ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --subject='Re: SCHED_IDLE documentation' \
    /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

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).