Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754327AbbGFPgU (ORCPT ); Mon, 6 Jul 2015 11:36:20 -0400 Received: from terminus.zytor.com ([198.137.202.10]:49034 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751427AbbGFPgP (ORCPT ); Mon, 6 Jul 2015 11:36:15 -0400 Date: Mon, 6 Jul 2015 08:35:39 -0700 From: tip-bot for Cong Wang Message-ID: Cc: hpa@zytor.com, xiyou.wangcong@gmail.com, tglx@linutronix.de, torvalds@linux-foundation.org, bsegall@google.com, linux-kernel@vger.kernel.org, peterz@infradead.org, cwang@twopensource.com, mingo@kernel.org Reply-To: hpa@zytor.com, xiyou.wangcong@gmail.com, tglx@linutronix.de, bsegall@google.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@kernel.org, cwang@twopensource.com In-Reply-To: <1435174907-432-1-git-send-email-xiyou.wangcong@gmail.com> References: <1435174907-432-1-git-send-email-xiyou.wangcong@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/fair: Test list head instead of list entry in throttle_cfs_rq() Git-Commit-ID: d49db342f0e276b354383b3281c5668b6b80f5c2 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1989 Lines: 48 Commit-ID: d49db342f0e276b354383b3281c5668b6b80f5c2 Gitweb: http://git.kernel.org/tip/d49db342f0e276b354383b3281c5668b6b80f5c2 Author: Cong Wang AuthorDate: Wed, 24 Jun 2015 12:41:47 -0700 Committer: Ingo Molnar CommitDate: Mon, 6 Jul 2015 14:15:08 +0200 sched/fair: Test list head instead of list entry in throttle_cfs_rq() According to the comments, we need to test if this is the first throttled task, however, list_empty() tests on the entry cfs_rq->throttled_list, not the head, this is wrong. This is a bug because we don't re-init the list entry after removing it from the list, so list_empty() could return false even if the list is really empty. Signed-off-by: Cong Wang Signed-off-by: Cong Wang Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Ben Segall Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1435174907-432-1-git-send-email-xiyou.wangcong@gmail.com Signed-off-by: Ingo Molnar --- 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 65c8f3e..d113c3b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3683,7 +3683,7 @@ static void throttle_cfs_rq(struct cfs_rq *cfs_rq) cfs_rq->throttled = 1; cfs_rq->throttled_clock = rq_clock(rq); raw_spin_lock(&cfs_b->lock); - empty = list_empty(&cfs_rq->throttled_list); + empty = list_empty(&cfs_b->throttled_cfs_rq); /* * Add to the _head_ of the list, so that an already-started -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/