All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Guillaume Chazarain <guichaz@yahoo.fr>
Cc: vatsa@linux.vnet.ibm.com, Ingo Molnar <mingo@elte.hu>,
	LKML <linux-kernel@vger.kernel.org>,
	dhaval@linux.vnet.ibm.com
Subject: Re: High wake up latencies with FAIR_USER_SCHED
Date: Thu, 31 Jan 2008 11:47:41 +0100	[thread overview]
Message-ID: <1201776461.28547.289.camel@lappy> (raw)
In-Reply-To: <3d8471ca0801281213l5ec62984i763afb22216cb423@mail.gmail.com>


On Mon, 2008-01-28 at 21:13 +0100, Guillaume Chazarain wrote:
> Unfortunately it seems to not be completely fixed, with this script:
> 
> #!/usr/bin/python
> 
> import os
> import time
> 
> SLEEP_TIME = 0.1
> SAMPLES = 5
> 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:
>     if os.fork() == 0:
>         os.setuid(1)
>         while True:
>             pass
>     else:
>         os.setuid(2)
>         while True:
>             pass
> else:
>     os.setuid(1)
>     print_wakeup_latency()
> 
> I get seemingly unpredictable latencies (with or without the patch applied):
> 
> # ./sched.py
> 14.810944 ms
> 19.829893 ms
> 1.968050 ms
> 8.021021 ms
> -0.017977 ms
> 4.926109 ms
> 11.958027 ms
> 5.995893 ms
> 1.992130 ms
> 0.007057 ms
> 0.217819 ms
> -0.004864 ms
> 5.907202 ms
> 6.547832 ms
> -0.012970 ms
> 0.209951 ms
> -0.002003 ms
> 4.989052 ms
> 
> Without FAIR_USER_SCHED, latencies are consistently in the noise.
> Also, I forgot to mention that I'm on a single CPU.
> 
> Thanks for the help.

Does something like this help?


Index: linux-2.6/kernel/sched_fair.c
===================================================================
--- linux-2.6.orig/kernel/sched_fair.c
+++ linux-2.6/kernel/sched_fair.c
@@ -267,8 +267,12 @@ static u64 sched_slice(struct cfs_rq *cf
 {
 	u64 slice = __sched_period(cfs_rq->nr_running);
 
-	slice *= se->load.weight;
-	do_div(slice, cfs_rq->load.weight);
+	for_each_sched_entity(se) {
+		cfs_rq = cfs_rq_of(se);
+
+		slice *= se->load.weight;
+		do_div(slice, cfs_rq->load.weight);
+	}
 
 	return slice;
 }



  parent reply	other threads:[~2008-01-31 10:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-27 20:01 High wake up latencies with FAIR_USER_SCHED Guillaume Chazarain
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 [this message]
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=1201776461.28547.289.camel@lappy \
    --to=a.p.zijlstra@chello.nl \
    --cc=dhaval@linux.vnet.ibm.com \
    --cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.