From: Mike Galbraith <efault@gmx.de>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
Arjan van de Ven <arjan@linux.intel.com>
Subject: Re: RFC [patch] sched: strengthen LAST_BUDDY and minimize buddy induced latencies V3
Date: Tue, 20 Oct 2009 07:03:37 +0200 [thread overview]
Message-ID: <1256015017.6568.32.camel@marge.simson.net> (raw)
In-Reply-To: <1256012656.17774.14.camel@laptop>
On Tue, 2009-10-20 at 06:24 +0200, Peter Zijlstra wrote:
> On Sat, 2009-10-17 at 12:24 +0200, Mike Galbraith wrote:
> > sched: strengthen LAST_BUDDY and minimize buddy induced latencies.
> >
> > This patch restores the effectiveness of LAST_BUDDY in preventing pgsql+oltp
> > from collapsing due to wakeup preemption. It also minimizes buddy induced
> > latencies. x264 testcase spawns new worker threads at a high rate, and was
> > being affected badly by NEXT_BUDDY. It turned out that CACHE_HOT_BUDDY was
> > thwarting idle balancing. This patch ensures that the load can disperse,
> > and that buddies can't make any task excessively late.
>
> > Index: linux-2.6/kernel/sched.c
> > ===================================================================
> > --- linux-2.6.orig/kernel/sched.c
> > +++ linux-2.6/kernel/sched.c
> > @@ -2007,8 +2007,12 @@ task_hot(struct task_struct *p, u64 now,
> >
> > /*
> > * Buddy candidates are cache hot:
> > + *
> > + * Do not honor buddies if there may be nothing else to
> > + * prevent us from becoming idle.
> > */
> > if (sched_feat(CACHE_HOT_BUDDY) &&
> > + task_rq(p)->nr_running >= sched_nr_latency &&
> > (&p->se == cfs_rq_of(&p->se)->next ||
> > &p->se == cfs_rq_of(&p->se)->last))
> > return 1;
>
> I'm not sure about this. The sched_nr_latency seems arbitrary, 1 seems
> like a more natural boundary.
That's what I did first, which of course worked fine.
What I'm thinking of doing instead though is to specifically target the
only time I see the problem, ie fork/exec load wanting to disperse. I
don't really want to see buddies being ripped away from their cache.
But as you note below, that can be a good thing iff it lands on a shared
cache. In my case, there's a 1 in 3 chance of safe landing.
> Also, one thing that arjan found was that we don't need to consider
> buddies cache hot if we're migrating them within a cache domain. So we
> need to add a SD_flag and sched_domain to properly represent the cache
> hierarchy.
Yeah, I thought about this too. If there's any overlap time, waking CPU
affine is a loser if there's an idle shared cache next door.
-Mike
next prev parent reply other threads:[~2009-10-20 5:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-17 10:24 Mike Galbraith
2009-10-20 4:24 ` Peter Zijlstra
2009-10-20 5:03 ` Mike Galbraith [this message]
2009-10-20 14:28 ` Mike Galbraith
2009-10-20 19:00 ` Mike Galbraith
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=1256015017.6568.32.camel@marge.simson.net \
--to=efault@gmx.de \
--cc=a.p.zijlstra@chello.nl \
--cc=arjan@linux.intel.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome