[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120927071011.GA8980@gmail.com>
Date: Thu, 27 Sep 2012 09:10:11 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Mike Galbraith <efault@....de>
Cc: Borislav Petkov <bp@...en8.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Mel Gorman <mgorman@...e.de>,
Nikolay Ulyanitsky <lystor@...il.com>,
linux-kernel@...r.kernel.org,
Andreas Herrmann <andreas.herrmann3@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Suresh Siddha <suresh.b.siddha@...el.com>
Subject: Re: 20% performance drop on PostgreSQL 9.2 from kernel 3.5.3 to
3.6-rc5 on AMD chipsets - bisected
* Mike Galbraith <efault@....de> wrote:
> > Do you have an easy-to-apply hack patch by chance that has
> > the effect of turning off all such preemption, which people
> > could try?
>
> They don't need any hacks, all they have to do is start
> postgreqsl SCHED_BATCH, then run pgbench the same way.
>
> I use schedctl, but in chrt speak, chrt -b 0
> /etc/init.d/postgresql start, and then the same for pgbench
> itself.
Just in case someone prefers patches to user-space approaches (I
certainly do!), here's one that turns off wakeup driven
preemption by default.
It can be turned back on via:
echo WAKEUP_PREEMPTION > /debug/sched_features
and off again via:
echo NO_WAKEUP_PREEMPTION > /debug/sched_features
(the patch is completely untested and such.)
The theory would be that this patch fixes psql performance, with
CPU selection being a measurable but second order of magnitude
effect. How well does practice match theory in this case?
Thanks,
Ingo
---------
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 6b800a1..f936552 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2907,7 +2907,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
* Batch and idle tasks do not preempt non-idle tasks (their preemption
* is driven by the tick):
*/
- if (unlikely(p->policy != SCHED_NORMAL))
+ if (unlikely(p->policy != SCHED_NORMAL) || !sched_feat(WAKEUP_PREEMPTION))
return;
find_matching_se(&se, &pse);
diff --git a/kernel/sched/features.h b/kernel/sched/features.h
index eebefca..e68e69a 100644
--- a/kernel/sched/features.h
+++ b/kernel/sched/features.h
@@ -32,6 +32,11 @@ SCHED_FEAT(LAST_BUDDY, true)
SCHED_FEAT(CACHE_HOT_BUDDY, true)
/*
+ * Allow wakeup-time preemption of the current task:
+ */
+SCHED_FEAT(WAKEUP_PREEMPTION, false)
+
+/*
* Use arch dependent cpu power functions
*/
SCHED_FEAT(ARCH_POWER, true)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists