public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nathanael Hoyle <nhoyle@hoyletech.com>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: scheduler nice 19 versus 'idle' behavior / static low-priority scheduling
Date: Fri, 30 Jan 2009 02:59:09 -0500	[thread overview]
Message-ID: <1233302349.17301.27.camel@localhost> (raw)
In-Reply-To: <alpine.LSU.2.00.0901300818580.28427@fbirervta.pbzchgretzou.qr>

On Fri, 2009-01-30 at 08:21 +0100, Jan Engelhardt wrote:
> On Friday 2009-01-30 07:40, Nathanael Hoyle wrote:
> >On Fri, 2009-01-30 at 07:16 +0100, Jan Engelhardt wrote:
> >
> >The one discussion I saw referencing SCHED_BATCH seemed to imply that it
> >was a non-standard kernel patch by Con Kolivas in one of his -ck
> >variants that never made it into mainline and is not being maintained.
> >Is this inaccurate?
> 
> The presence of SCHED_BATCH in linux/sched.h tells me it is available
> (on the other hand, SCHED_ISO, also from -ck, is only listed as a comment.)
> 

Fair enough. I should have re-checked recent sources after your mention
rather than going on the old thread I found.

> >I was unfamiliar with SCHED_IDLE. Having done a little Googling now, I
> >finally find reference to the man page for sched_setscheduler(2). This
> >appears that it is likely what I wanted.
> >
> >I think the information I had been able to find was somehwat out of
> >date.
> 
> The manpage does say it, but if your local distro does not 
> mention SCHED_BATCH/SCHED_IDLE, then that's a pretty sad distro.
> 
> The doc in sched_setschedule seems complete to me as of man-pages 3.13.
> 
> >Is there currently a standardized userspace tool to use to run a command
> >in order to alter its scheduling class? Obviously writing one would be
> >trivial, but didn't know if something like:
> 
> man chrt

The latest version of man chrt that I can find implies that it handles
SCHED_BATCH but not SCHED_IDLE. To that end, if anyone else is
interested, I have thrown together the above-suggested 'runidle' which
will invoke the passed command using the SCHED_IDLE scheduler; it's
nothing fancy.

I am running foldingathome under it at the moment, and it seems to be
improving the situation somewhat, but I still need/want to test with
Mike's referenced patches.

runidle.c:

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sched.h>
#include <linux/sched.h>

extern char **environ;

int
main(int argc, char **argv) {
  if(argc<2) {
    perror("Must specify at least one argument: the path to the program
to " \
      "execute. Additional arguments may be specified which will be
passed " \
      "to the called program.");
    return EXIT_FAILURE;
  }

  sched_setscheduler(0, SCHED_IDLE, NULL);

  if(argc==2) {
    if(execve(argv[1], NULL, environ) == -1) {
      perror("Failed to execve target!");
    }
  } else {
    if(execve(argv[1], argv+1, environ) == -1) {
      perror("Failed to execve target!");
    }
  }

  /* should be unreachable */
  return EXIT_FAILURE;
}

-Nathanael


  reply	other threads:[~2009-01-30  7:59 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-30  5:49 scheduler nice 19 versus 'idle' behavior / static low-priority scheduling Nathanael Hoyle
2009-01-30  6:16 ` Jan Engelhardt
2009-01-30  6:40   ` Nathanael Hoyle
2009-01-30  7:21     ` Jan Engelhardt
2009-01-30  7:59       ` Nathanael Hoyle [this message]
2009-01-30  8:07         ` Mike Galbraith
2009-01-30  8:55           ` Nathanael Hoyle
2009-01-30  9:29             ` Mike Galbraith
2009-01-30 22:12           ` Brian Rogers
2009-01-31  5:38             ` Mike Galbraith
2009-01-31  9:08               ` Mike Galbraith
2009-02-02 23:57                 ` [stable] " Greg KH
2009-02-09 15:19                   ` Brian Rogers
2009-02-09 15:51                     ` Greg KH
2009-01-30  8:16         ` Nathanael Hoyle
2009-01-30 13:56           ` Jan Engelhardt
2009-01-30 14:15         ` Jan Engelhardt
2009-01-30  6:17 ` V.Radhakrishnan
2009-01-30  6:48   ` Nathanael Hoyle
2009-01-30 14:15     ` Jan Engelhardt
2009-01-30  6:24 ` Mike Galbraith
2009-01-30  6:52   ` Nathanael Hoyle
2009-01-30  7:09     ` Mike Galbraith
2009-01-30  8:50 ` Peter Zijlstra
2009-01-30  9:00   ` Nathanael Hoyle
2009-01-30  9:03     ` Peter Zijlstra
2009-01-30 10:18       ` Nathanael Hoyle
2009-01-30 10:31         ` Mike Galbraith
2009-01-30 10:40           ` Peter Zijlstra
2009-01-30 10:50             ` Mike Galbraith
2009-02-02 17:23 ` Lennart Sorensen

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=1233302349.17301.27.camel@localhost \
    --to=nhoyle@hoyletech.com \
    --cc=jengelh@medozas.de \
    --cc=linux-kernel@vger.kernel.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