mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Galbraith <efault@gmx.de>
To: "Zhang, Yanmin" <yanmin_zhang@linux.intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>
Subject: Re: hackbench regression with kernel 2.6.32-rc1
Date: Fri, 16 Oct 2009 13:06:32 +0200	[thread overview]
Message-ID: <1255691192.7029.13.camel@marge.simson.net> (raw)
In-Reply-To: <1255403522.3684.57.camel@ymzhang>

On Tue, 2009-10-13 at 11:12 +0800, Zhang, Yanmin wrote:

> NEXT_BUDDY has no help on volanoMark and tbench.

Can you try the patch below please?  It does tries to preserve buddy
affinity where possible, and mitigates over-preemption by strengthening
buddies a bit.  It improves vmark here by ~7%.

diff --git a/kernel/sched.c b/kernel/sched.c
index 00f9e71..fb025d4 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2007,8 +2007,12 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd)
 
 	/*
 	 * 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;
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index c32c3e6..428bf55 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -863,18 +863,20 @@ static struct sched_entity *pick_next_entity(struct cfs_rq *cfs_rq)
 	struct sched_entity *se = __pick_next_entity(cfs_rq);
 	struct sched_entity *buddy;
 
-	if (cfs_rq->next) {
+	if (cfs_rq->next && sched_feat(NEXT_BUDDY)) {
 		buddy = cfs_rq->next;
-		cfs_rq->next = NULL;
-		if (wakeup_preempt_entity(buddy, se) < 1)
+		if (wakeup_preempt_entity(buddy, se) < 1) {
+			cfs_rq->next = NULL;
 			return buddy;
+		}
 	}
 
-	if (cfs_rq->last) {
+	if (cfs_rq->last && sched_feat(LAST_BUDDY)) {
 		buddy = cfs_rq->last;
-		cfs_rq->last = NULL;
-		if (wakeup_preempt_entity(buddy, se) < 1)
+		if (wakeup_preempt_entity(buddy, se) < 1) {
+			cfs_rq->last = NULL;
 			return buddy;
+		}
 	}
 
 	return se;
@@ -1600,9 +1602,9 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
 	 * Also, during early boot the idle thread is in the fair class, for
 	 * obvious reasons its a bad idea to schedule back to the idle thread.
 	 */
-	if (sched_feat(LAST_BUDDY) && likely(se->on_rq && curr != rq->idle))
+	if (!(wake_flags & WF_FORK) && likely(se->on_rq && curr != rq->idle))
 		set_last_buddy(se);
-	if (sched_feat(NEXT_BUDDY) && !(wake_flags & WF_FORK))
+	if (!(wake_flags & WF_FORK))
 		set_next_buddy(pse);
 
 	/*



  parent reply	other threads:[~2009-10-16 11:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-09  9:19 Zhang, Yanmin
2009-10-09 10:43 ` Peter Zijlstra
2009-10-12  7:05   ` Zhang, Yanmin
2009-10-12  8:05     ` Mike Galbraith
2009-10-12 14:21     ` Peter Zijlstra
2009-10-12 14:33       ` Mike Galbraith
2009-10-13  3:12       ` Zhang, Yanmin
2009-10-13  9:39         ` Mike Galbraith
2009-10-13 11:08           ` Mike Galbraith
2009-10-16 11:06         ` Mike Galbraith [this message]
2009-10-27  8:03           ` Zhang, Yanmin
2009-10-27 14:42             ` Mike Galbraith
2009-10-28  9:29               ` Zhang, Yanmin
2009-10-28 14:22                 ` Mike Galbraith
2009-10-29  0:50                   ` Zhang, Yanmin
2009-10-29  5:46                     ` Mike Galbraith
2009-10-29  6:26                       ` Zhang, Yanmin
2009-10-29  9:14                         ` [patch] " Mike Galbraith
2009-10-30  2:02                           ` Zhang, Yanmin
2009-10-14 13:13   ` [tip:sched/urgent] sched: Do less agressive buddy clearing tip-bot for 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=1255691192.7029.13.camel@marge.simson.net \
    --to=efault@gmx.de \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=yanmin_zhang@linux.intel.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

Powered by JetHome