linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kirill Tkhai <ktkhai@odin.com>
To: <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>
Subject: [PATCH] sched/fair: Skip wake_affine() for core siblings
Date: Fri, 25 Sep 2015 20:54:07 +0300	[thread overview]
Message-ID: <56058A3F.5060408@odin.com> (raw)

We are not interested in actual target if both prev
and curr cpus share CPU cache. select_idle_sibling()
searches in top-down order; top level is the same
for both of them, and the result will be the same.
So, we can save a little CPU cycles and cache misses
and skip wake_affine() calculations.

tbench on 2 physical CPU Xeon (x 6 cores x 2 ht) inside cgroup:

threads  | Before         |  After
-------------------------------------------
      1  | 203.943 MB/sec |  211.524 MB/sec
      2  | 407.211 MB/sec |  411.701 MB/sec
      3  | 591.089 MB/sec |  608.404 MB/sec
      4  | 743.768 MB/sec |  790.026 MB/sec (+ 6.2%)
      5  | 914.237 MB/sec |  972.882 MB/sec (+ 6.4%)
      6  | 1053.91 MB/sec |  1092.81 MB/sec
      7  | 1208.24 MB/sec |  1281.1 MB/sec  (+ 6.0%)
      8  | 1357.53 MB/sec |  1385.79 MB/sec
      9  | 1474.11 MB/sec |  1496.76 MB/sec
     10  | 1586.89 MB/sec |  1616.76 MB/sec
     11  | 1720.17 MB/sec |  1732.7 MB/sec
     12  | 1835.4 MB/sec  |  1868.77 MB/sec
     13  | 1964.76 MB/sec |  2003.68 MB/sec
     14  | 2117.01 MB/sec |  2128.16 MB/sec
     15  | 2220.97 MB/sec |  2254.8 MB/sec
     16  | 2326.52 MB/sec |  2378.38 MB/sec
     17  | 2458.79 MB/sec |  2484.15 MB/sec
     18  | 2473.59 MB/sec |  2591.01 MB/sec (+ 4.7%)

Signed-off-by: Kirill Tkhai <ktkhai@odin.com>
---
 kernel/sched/fair.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 4df37a4..b378c34 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4666,6 +4666,9 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync)
 	unsigned long weight;
 	int balanced;
 
+	if (sd->flags & SD_SHARE_PKG_RESOURCES)
+		return 1;
+
 	idx	  = sd->wake_idx;
 	this_cpu  = smp_processor_id();
 	prev_cpu  = task_cpu(p);


             reply	other threads:[~2015-09-25 17:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-25 17:54 Kirill Tkhai [this message]
2015-09-26 15:25 ` [PATCH] sched/fair: Skip wake_affine() for core siblings Mike Galbraith
2015-09-28 10:28   ` Kirill Tkhai
2015-09-28 13:12     ` Mike Galbraith
2015-09-28 15:36       ` Kirill Tkhai
2015-09-28 15:49         ` Kirill Tkhai
2015-09-28 18:22         ` Mike Galbraith
2015-09-28 19:19           ` Kirill Tkhai
2015-09-29  2:03             ` Mike Galbraith
2015-09-29 14:55         ` Mike Galbraith
2015-09-29 16:00           ` Kirill Tkhai
2015-09-29 16:03             ` Kirill Tkhai
2015-09-29 17:29             ` Mike Galbraith
2015-09-30 19:16               ` Kirill Tkhai

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=56058A3F.5060408@odin.com \
    --to=ktkhai@odin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).