mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Guillaume Chazarain" <guichaz@yahoo.fr>
To: "Srivatsa Vaddagiri" <vatsa@linux.vnet.ibm.com>,
	"Ingo Molnar" <mingo@elte.hu>,
	LKML <linux-kernel@vger.kernel.org>
Subject: High wake up latencies with FAIR_USER_SCHED
Date: Sun, 27 Jan 2008 21:01:15 +0100	[thread overview]
Message-ID: <3d8471ca0801271201o5a41955cg552ef06a2f821285@mail.gmail.com> (raw)

Hi,

I noticed some strangely high wake up latencies with FAIR_USER_SCHED
using this script:

#!/usr/bin/python

import os
import time

SLEEP_TIME = 0.1
SAMPLES = 100
PRINT_DELAY = 0.5

def print_wakeup_latency():
    times = []
    last_print = 0
    while True:
        start = time.time()
        time.sleep(SLEEP_TIME)
        end = time.time()
        times.insert(0, end - start - SLEEP_TIME)
        del times[SAMPLES:]
        if end > last_print + PRINT_DELAY:
            copy = times[:]
            copy.sort()
            print '%f ms' % (copy[len(copy)/2] * 1000)
            last_print = end

if os.fork() == 0:
    os.setuid(1)
    for i in xrange(2):
        if os.fork() == 0:
            while True:
                pass
else:
    os.setuid(2) # <-- here
    print_wakeup_latency()

We have two busy loops with UID=1.
And UID=2 maintains the running median of its wake up latency.
I get these latencies:

# ./sched.py
4.300022 ms
4.801178 ms
4.604006 ms
4.606867 ms
4.604006 ms
4.606867 ms
4.604006 ms
4.606867 ms
4.606867 ms
4.676008 ms
4.604006 ms
4.604006 ms
4.606867 ms

Disabling FAIR_USER_SCHED restores wake up latencies in the noise:

# ./sched.py
-0.156975 ms
-0.067091 ms
-0.022984 ms
-0.022984 ms
-0.022030 ms
-0.022030 ms
-0.022030 ms
-0.021076 ms
-0.015831 ms
-0.015831 ms
-0.016069 ms
-0.015831 ms

Strangely enough, another way to restore normal latencies is to change
setuid(2) to setuid(1), that is, putting the latency measurement in
the same group as the two busy loops.

Thanks in advance for any help.

-- 
Guillaume

             reply	other threads:[~2008-01-27 20:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-27 20:01 Guillaume Chazarain [this message]
2008-01-28  2:31 ` Srivatsa Vaddagiri
2008-01-28 12:27   ` Ingo Molnar
2008-01-28 16:57   ` Guillaume Chazarain
2008-01-28 20:13     ` Guillaume Chazarain
2008-01-29  5:47       ` Srivatsa Vaddagiri
2008-01-29 15:53         ` Guillaume Chazarain
2008-01-29 16:26           ` Srivatsa Vaddagiri
2008-01-31 10:47       ` Peter Zijlstra
2008-01-31 12:49         ` Guillaume Chazarain
2008-01-31 13:00           ` Peter Zijlstra

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=3d8471ca0801271201o5a41955cg552ef06a2f821285@mail.gmail.com \
    --to=guichaz@yahoo.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=vatsa@linux.vnet.ibm.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®