mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Micah Dowty <micah@vmware.com>
To: Dmitry Adamushko <dmitry.adamushko@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, Christoph Lameter <clameter@sgi.com>,
	Kyle Moffett <mrmacman_g4@mac.com>,
	Cyrus Massoumi <cyrusm@gmx.net>,
	LKML Kernel <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>, Mike Galbraith <efault@gmx.de>,
	Paul Menage <menage@google.com>,
	Peter Williams <pwil3058@bigpond.net.au>
Subject: Re: High priority tasks break SMP balancer?
Date: Fri, 16 Nov 2007 17:03:52 -0800	[thread overview]
Message-ID: <20071117010352.GA13666@vmware.com> (raw)
In-Reply-To: <b647ffbd0711161526p2faf5abt2457084f1996c735@mail.gmail.com>

On Sat, Nov 17, 2007 at 12:26:41AM +0100, Dmitry Adamushko wrote:
> Let's say we change a pattern for the niced task: e.g. run for 100 ms.
> and then sleep for 300 ms. (that's ~25% of cpu load) in the loop. Any
> behavioral changes?

For consistency, I tested this using /dev/rtc. I set the rtc frequency
to 16 Hz, and replaced the main loop of my high (-19) priority thread
with:

   while (1) {
      unsigned long data;

      for (i = 0; i < 3; i++) {
         if (read(rtc, &data, sizeof data) != sizeof data) {
            perror("read");
            return 1;
         }
      }

      fcntl(rtc, F_SETFL, O_NONBLOCK);
      while (read(rtc, &data, sizeof data) < 0);
      fcntl(rtc, F_SETFL, 0);
   }

Now it's busy-looping for 62ms, and sleeping for three consecutive
62.5ms chunks totalling 187.5ms.

The results aren't quite what I was expecting. I have only observed
this so far in test cases where I have a very high wakeup frequency,
so I wasn't expecting this to work. I did, however, still observe the
problem where occasionally I get into a state where one CPU is mostly
idle.

Qualitatively, this feels a bit different. With the higher clock
frequency it seemed like the CPU would easily get "stuck" in this
state where it's mostly idle, and it would stay there for a long
time. With the low wakeup frequency, I'm seeing it toggle between the
busy and mostly-idle states more quickly.

I tried a similar test using usleep() and gettimeofday() rather than
/dev/rtc:

   while (1) {
      usleep(300000);

      gettimeofday(&t1, NULL);
      do {
         gettimeofday(&t2, NULL);
      } while (t2.tv_usec - t1.tv_usec +
               (t2.tv_sec - t1.tv_sec) * 1000000 < 100000);
   }

With this test program, I haven't yet seen a CPU imbalance that lasts
longer than a fraction of a second.

--Micah


  reply	other threads:[~2007-11-17  1:05 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-09 22:34 Micah Dowty
2007-11-09 23:56 ` Cyrus Massoumi
2007-11-10  0:11   ` Micah Dowty
2007-11-14 18:39     ` Micah Dowty
2007-11-15 18:48     ` Kyle Moffett
2007-11-15 19:14       ` Micah Dowty
2007-11-15 20:07         ` Christoph Lameter
2007-11-15 20:24           ` Micah Dowty
2007-11-15 21:28             ` Christoph Lameter
2007-11-15 21:35               ` Micah Dowty
2007-11-16  2:31                 ` Christoph Lameter
2007-11-16  2:44                   ` Micah Dowty
2007-11-16  6:07                     ` Ingo Molnar
2007-11-16  9:19                       ` Micah Dowty
2007-11-16 10:45                         ` Ingo Molnar
2007-11-16 10:48                       ` Micah Dowty
2007-11-16 22:12                         ` Christoph Lameter
2007-11-16 10:48                       ` Dmitry Adamushko
2007-11-16 22:14                         ` Micah Dowty
2007-11-16 23:26                           ` Dmitry Adamushko
2007-11-17  1:03                             ` Micah Dowty [this message]
2007-11-17 19:10                               ` Dmitry Adamushko
2007-11-19 18:51                                 ` Micah Dowty
2007-11-19 22:22                                   ` Dmitry Adamushko
2007-11-19 23:05                                     ` Micah Dowty
2007-11-20  5:57                                       ` Ingo Molnar
2007-11-20 18:06                                         ` Micah Dowty
2007-11-20 21:47                                           ` Dmitry Adamushko
2007-11-22  7:46                                             ` Micah Dowty
2007-11-22 12:53                                               ` Dmitry Adamushko
2007-11-26 19:44                                                 ` Micah Dowty
2007-11-27  9:21                                                   ` Dmitry Adamushko
2007-11-27 17:13                                                     ` Micah Dowty
2007-11-16 19:13         ` David Newall
2007-11-16 21:38           ` Micah Dowty

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=20071117010352.GA13666@vmware.com \
    --to=micah@vmware.com \
    --cc=akpm@osdl.org \
    --cc=clameter@sgi.com \
    --cc=cyrusm@gmx.net \
    --cc=dmitry.adamushko@gmail.com \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=menage@google.com \
    --cc=mingo@elte.hu \
    --cc=mrmacman_g4@mac.com \
    --cc=pwil3058@bigpond.net.au \
    /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

Powered by JetHome