All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>
To: "Guillaume Chazarain" <guichaz@yahoo.fr>
Cc: "Ingo Molnar" <mingo@elte.hu>,
	LKML <linux-kernel@vger.kernel.org>,
	a.p.zijlstra@chello.nl, dhaval@linux.vnet.ibm.com
Subject: Re: High wake up latencies with FAIR_USER_SCHED
Date: Mon, 28 Jan 2008 08:01:29 +0530	[thread overview]
Message-ID: <20080128023129.GD1044@linux.vnet.ibm.com> (raw)
In-Reply-To: <3d8471ca0801271201o5a41955cg552ef06a2f821285@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1779 bytes --]

On Sun, Jan 27, 2008 at 09:01:15PM +0100, Guillaume Chazarain wrote:
> I noticed some strangely high wake up latencies with FAIR_USER_SCHED
> using this script:

<snip>

> 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

Given that sysctl_sched_wakeup_granularity is set to 10ms by default,
this doesn't sound abnormal.

<snip>

> Disabling FAIR_USER_SCHED restores wake up latencies in the noise:
> 
> # ./sched.py
> -0.156975 ms
> -0.067091 ms
> -0.022984 ms

The reason why we are getting better wakeup latencies for !FAIR_USER_SCHED is 
because of this snippet of code in place_entity():

	if (!initial) {
		/* sleeps upto a single latency don't count. */
		if (sched_feat(NEW_FAIR_SLEEPERS) && entity_is_task(se))
						     ^^^^^^^^^^^^^^^^^^
			vruntime -= sysctl_sched_latency;

		/* ensure we never gain time by being placed backwards. */
		vruntime = max_vruntime(se->vruntime, vruntime);
	}


NEW_FAIR_SLEEPERS feature gives credit for sleeping only to tasks and
not group-level entities. With the patch attached, I could see that wakeup 
latencies with FAIR_USER_SCHED are restored to the same level as 
!FAIR_USER_SCHED. 

However I am not sure whether that is the way to go. We want to let one group of
tasks running as much as possible until the fairness/wakeup-latency threshold is
exceeded. If someone does want better wakeup latencies between groups too, they 
can always tune sysctl_sched_wakeup_granularity.

<snip>

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



-- 
Regards,
vatsa

[-- Attachment #2: fix.patch --]
[-- Type: text/plain, Size: 548 bytes --]


---
 kernel/sched_fair.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Index: current/kernel/sched_fair.c
===================================================================
--- current.orig/kernel/sched_fair.c
+++ current/kernel/sched_fair.c
@@ -511,7 +511,7 @@
 
 	if (!initial) {
 		/* sleeps upto a single latency don't count. */
-		if (sched_feat(NEW_FAIR_SLEEPERS) && entity_is_task(se))
+		if (sched_feat(NEW_FAIR_SLEEPERS))
 			vruntime -= sysctl_sched_latency;
 
 		/* ensure we never gain time by being placed backwards. */

  reply	other threads:[~2008-01-28  2:17 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 [this message]
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=20080128023129.GD1044@linux.vnet.ibm.com \
    --to=vatsa@linux.vnet.ibm.com \
    --cc=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 \
    /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.