From: Wanpeng Li <kernellwp@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Wanpeng Li <wanpeng.li@hotmail.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>
Subject: [PATCH] sched/fair: Fix the nohz.next_balance update mess
Date: Sun, 5 Feb 2017 01:57:35 -0800 [thread overview]
Message-ID: <1486288655-8620-1-git-send-email-wanpeng.li@hotmail.com> (raw)
From: Wanpeng Li <wanpeng.li@hotmail.com>
The commit:
c5afb6a87f2 ("sched/fair: Fix nohz.next_balance update")
intends to update nohz.next_balance in two steps.
1) The ILB CPU utilizes next_balance variable in nohz_idle_balance()
to gather the shortest next balance of other idle CPUs before
updating nohz.next_balance.
2) The ILB CPU updates the nohz.next_balance according to its own
next_balance after load balance on behalf of other idle CPUs.
However, there is a mess which breaks the original intention of the
first step, every idle CPUs update nohz.next_balance during ILB CPU
on behalf of them to do load balance, and then the ILB CPU utilizes
next_balance variable in nohz_idle_balance() to gather the shortest
next balance of other idle CPUs before updating nohz.next_balance.
This patch fixes it by don't update nohz.next_balance for other idle
CPUs when ILB CPU on behalf of them to do load balance.
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
CC: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
---
kernel/sched/fair.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 274c747..83948a4 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8750,7 +8750,8 @@ static void rebalance_domains(struct rq *rq, enum cpu_idle_type idle)
* balance for itself and we need to update the
* nohz.next_balance accordingly.
*/
- if ((idle == CPU_IDLE) && time_after(nohz.next_balance, rq->next_balance))
+ if ((idle == CPU_IDLE) && time_after(nohz.next_balance, rq->next_balance) &&
+ !test_bit(NOHZ_BALANCE_KICK, nohz_flags(this_rq()->cpu)))
nohz.next_balance = rq->next_balance;
#endif
}
--
2.7.4
next reply other threads:[~2017-02-05 10:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-05 9:57 Wanpeng Li [this message]
2017-02-06 8:07 ` [PATCH] sched/fair: Fix the nohz.next_balance update mess Vincent Guittot
2017-02-06 8:33 ` Wanpeng Li
2017-02-06 13:23 ` Vincent Guittot
2017-02-06 22:06 ` Wanpeng Li
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=1486288655-8620-1-git-send-email-wanpeng.li@hotmail.com \
--to=kernellwp@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=vincent.guittot@linaro.org \
--cc=wanpeng.li@hotmail.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;
as well as URLs for NNTP newsgroup(s).