* [PATCH] sched_fair: test list head instead of list entry in throttle_cfs_rq()
@ 2015-06-24 19:41 Cong Wang
2015-06-25 17:11 ` bsegall
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Cong Wang @ 2015-06-24 19:41 UTC (permalink / raw)
To: linux-kernel; +Cc: Cong Wang, Ingo Molnar, Peter Zijlstra, Cong Wang
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.
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Cong Wang <cwang@twopensource.com>
---
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 40a7fcb..ee91917 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
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] sched_fair: test list head instead of list entry in throttle_cfs_rq()
2015-06-24 19:41 [PATCH] sched_fair: test list head instead of list entry in throttle_cfs_rq() Cong Wang
@ 2015-06-25 17:11 ` bsegall
2015-07-03 16:09 ` Cong Wang
2015-07-06 15:35 ` [tip:sched/core] sched/fair: Test " tip-bot for Cong Wang
2 siblings, 0 replies; 6+ messages in thread
From: bsegall @ 2015-06-25 17:11 UTC (permalink / raw)
To: Cong Wang; +Cc: linux-kernel, Ingo Molnar, Peter Zijlstra, Cong Wang
Cong Wang <xiyou.wangcong@gmail.com> writes:
> 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.
>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> Signed-off-by: Cong Wang <cwang@twopensource.com>
Agreed.
Reviewed-by: Ben Segall <bsegall@google.com>
> ---
> 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 40a7fcb..ee91917 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sched_fair: test list head instead of list entry in throttle_cfs_rq()
2015-06-24 19:41 [PATCH] sched_fair: test list head instead of list entry in throttle_cfs_rq() Cong Wang
2015-06-25 17:11 ` bsegall
@ 2015-07-03 16:09 ` Cong Wang
2015-07-03 16:10 ` Peter Zijlstra
2015-07-06 15:35 ` [tip:sched/core] sched/fair: Test " tip-bot for Cong Wang
2 siblings, 1 reply; 6+ messages in thread
From: Cong Wang @ 2015-07-03 16:09 UTC (permalink / raw)
To: LKML; +Cc: Cong Wang, Ingo Molnar, Peter Zijlstra, Cong Wang
On Wed, Jun 24, 2015 at 12:41 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> 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.
>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> Signed-off-by: Cong Wang <cwang@twopensource.com>
ping.
What's the status of this patch?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sched_fair: test list head instead of list entry in throttle_cfs_rq()
2015-07-03 16:09 ` Cong Wang
@ 2015-07-03 16:10 ` Peter Zijlstra
2015-07-03 16:11 ` Cong Wang
0 siblings, 1 reply; 6+ messages in thread
From: Peter Zijlstra @ 2015-07-03 16:10 UTC (permalink / raw)
To: Cong Wang; +Cc: LKML, Ingo Molnar, Cong Wang
On Fri, Jul 03, 2015 at 09:09:12AM -0700, Cong Wang wrote:
> On Wed, Jun 24, 2015 at 12:41 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> > 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.
> >
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> > Signed-off-by: Cong Wang <cwang@twopensource.com>
>
> ping.
>
> What's the status of this patch?
Queued, will likely hit tip after the merge window etc has settled.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sched_fair: test list head instead of list entry in throttle_cfs_rq()
2015-07-03 16:10 ` Peter Zijlstra
@ 2015-07-03 16:11 ` Cong Wang
0 siblings, 0 replies; 6+ messages in thread
From: Cong Wang @ 2015-07-03 16:11 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: LKML, Ingo Molnar, Cong Wang
On Fri, Jul 3, 2015 at 9:10 AM, Peter Zijlstra <peterz@infradead.org> wrote:
>
> Queued, will likely hit tip after the merge window etc has settled.
Great.
Thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
* [tip:sched/core] sched/fair: Test list head instead of list entry in throttle_cfs_rq()
2015-06-24 19:41 [PATCH] sched_fair: test list head instead of list entry in throttle_cfs_rq() Cong Wang
2015-06-25 17:11 ` bsegall
2015-07-03 16:09 ` Cong Wang
@ 2015-07-06 15:35 ` tip-bot for Cong Wang
2 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Cong Wang @ 2015-07-06 15:35 UTC (permalink / raw)
To: linux-tip-commits
Cc: hpa, xiyou.wangcong, tglx, torvalds, bsegall, linux-kernel,
peterz, cwang, mingo
Commit-ID: d49db342f0e276b354383b3281c5668b6b80f5c2
Gitweb: http://git.kernel.org/tip/d49db342f0e276b354383b3281c5668b6b80f5c2
Author: Cong Wang <xiyou.wangcong@gmail.com>
AuthorDate: Wed, 24 Jun 2015 12:41:47 -0700
Committer: Ingo Molnar <mingo@kernel.org>
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 <xiyou.wangcong@gmail.com>
Signed-off-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Ben Segall <bsegall@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1435174907-432-1-git-send-email-xiyou.wangcong@gmail.com
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 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
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-07-06 15:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-24 19:41 [PATCH] sched_fair: test list head instead of list entry in throttle_cfs_rq() Cong Wang
2015-06-25 17:11 ` bsegall
2015-07-03 16:09 ` Cong Wang
2015-07-03 16:10 ` Peter Zijlstra
2015-07-03 16:11 ` Cong Wang
2015-07-06 15:35 ` [tip:sched/core] sched/fair: Test " tip-bot for Cong Wang
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).