From: Mel Gorman <mgorman@techsingularity.net>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Mike Galbraith <efault@gmx.de>,
Matt Fleming <matt@codeblueprint.co.uk>,
LKML <linux-kernel@vger.kernel.org>,
Mel Gorman <mgorman@techsingularity.net>
Subject: [PATCH 4/4] sched/fair: Do not migrate due to a sync wakeup on exit
Date: Mon, 12 Feb 2018 14:58:57 +0000 [thread overview]
Message-ID: <20180212145857.8056-5-mgorman@techsingularity.net> (raw)
In-Reply-To: <20180212145857.8056-1-mgorman@techsingularity.net>
When a task exits, it notifies the parent that it has exited. This is a sync
wakup and the exiting task may pull the parent towards the wakers CPU. For
even simple workloads like using a shell, it was observed that the shell
is pulled across nodes by exiting processes. This is daft as the parent
may be long-lived and properly placed. This patch special cases a sync
wakeup on exit to avoid pulling tasks across nodes. Testing on a range
of workloads and machines showed very little differences in performance
although there was a small 3% boost on some machines running a shellscript
intensive workload (git regression test suite).
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
---
kernel/sched/fair.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 28c8d9c91955..50442697b455 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5710,8 +5710,14 @@ wake_affine_idle(int this_cpu, int prev_cpu, int sync)
if (idle_cpu(this_cpu) && cpus_share_cache(this_cpu, prev_cpu))
return idle_cpu(prev_cpu) ? prev_cpu : this_cpu;
- if (sync && cpu_rq(this_cpu)->nr_running == 1)
+ if (sync && cpu_rq(this_cpu)->nr_running == 1) {
+ /* Avoid tasks exiting pulling parents to new nodes */
+ if ((current->flags & PF_EXITING) &&
+ !cpus_share_cache(this_cpu, prev_cpu))
+ return prev_cpu;
+
return this_cpu;
+ }
return nr_cpumask_bits;
}
--
2.15.1
next prev parent reply other threads:[~2018-02-12 14:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-12 14:58 [PATCH 0/4] Reduce migrations due to load imbalance and process exits Mel Gorman
2018-02-12 14:58 ` [PATCH 1/4] sched/fair: Avoid an unnecessary lookup of current CPU ID during wake_affine Mel Gorman
2018-02-12 14:58 ` [PATCH 2/4] sched/fair: Defer calculation of prev_eff_load in wake_affine until needed Mel Gorman
2018-02-12 14:58 ` [PATCH 3/4] sched/fair: Do not migrate on wake_affine_weight if weights are equal Mel Gorman
2018-02-12 17:29 ` Peter Zijlstra
2018-02-12 17:43 ` Mel Gorman
2018-02-12 19:14 ` Mike Galbraith
2018-02-12 19:57 ` Peter Zijlstra
2018-02-12 20:20 ` Mel Gorman
2018-02-12 14:58 ` Mel Gorman [this message]
2018-02-12 17:31 ` [PATCH 4/4] sched/fair: Do not migrate due to a sync wakeup on exit Peter Zijlstra
2018-02-12 17:47 ` Mel Gorman
2018-02-12 18:01 ` Mel Gorman
2018-02-12 20:01 ` Andreas Mohr
2018-02-12 20:09 ` Mel Gorman
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=20180212145857.8056-5-mgorman@techsingularity.net \
--to=mgorman@techsingularity.net \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@codeblueprint.co.uk \
--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
all inboxes | Powered by JetHome®