From: tip-bot for Xunlei Pang <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de,
bsegall@google.com, pang.xunlei@linaro.org, peterz@infradead.org,
torvalds@linux-foundation.org, mingo@kernel.org, hpa@zytor.com
Subject: [tip:sched/core] sched/fair: Fix the dealing with decay_count in __synchronize_entity_decay()
Date: Wed, 14 Jan 2015 06:01:30 -0800 [thread overview]
Message-ID: <tip-638476007d13534b2ed4134bf0279ef44071140b@git.kernel.org> (raw)
In-Reply-To: <1418745509-2609-1-git-send-email-pang.xunlei@linaro.org>
Commit-ID: 638476007d13534b2ed4134bf0279ef44071140b
Gitweb: http://git.kernel.org/tip/638476007d13534b2ed4134bf0279ef44071140b
Author: Xunlei Pang <pang.xunlei@linaro.org>
AuthorDate: Tue, 16 Dec 2014 23:58:29 +0800
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 14 Jan 2015 13:34:13 +0100
sched/fair: Fix the dealing with decay_count in __synchronize_entity_decay()
In __synchronize_entity_decay(), if "decays" happens to be zero,
se->avg.decay_count will not be zeroed, holding the positive value
assigned when dequeued last time.
This is problematic in the following case:
If this runnable task is CFS-balanced to other CPUs soon afterwards,
migrate_task_rq_fair() will treat it as a blocked task due to its
non-zero decay_count, thereby adding its load to cfs_rq->removed_load
wrongly.
Thus, we must zero se->avg.decay_count in this case as well.
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Ben Segall <bsegall@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1418745509-2609-1-git-send-email-pang.xunlei@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 40667cb..97000a9 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2574,11 +2574,11 @@ static inline u64 __synchronize_entity_decay(struct sched_entity *se)
u64 decays = atomic64_read(&cfs_rq->decay_counter);
decays -= se->avg.decay_count;
+ se->avg.decay_count = 0;
if (!decays)
return 0;
se->avg.load_avg_contrib = decay_load(se->avg.load_avg_contrib, decays);
- se->avg.decay_count = 0;
return decays;
}
prev parent reply other threads:[~2015-01-14 14:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-16 15:58 [PATCH] " Xunlei Pang
2014-12-16 18:09 ` bsegall
2015-01-14 14:01 ` tip-bot for Xunlei Pang [this message]
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=tip-638476007d13534b2ed4134bf0279ef44071140b@git.kernel.org \
--to=tipbot@zytor.com \
--cc=bsegall@google.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=pang.xunlei@linaro.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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
Powered by JetHome