2008-12-15 06:27:18

by Bharata B Rao

[permalink] [raw]
Subject: [PATCH] sched: Use RCU variant of list traversal in for_each_leaf_rt_rq()

sched: Use RCU variant of list traversal in for_each_leaf_rt_rq()

for_each_leaf_rt_rq() walks an RCU protected list (rq->leaf_rt_rq_list),
but doesn't use list_for_each_entry_rcu(). Fix this.

Signed-off-by: Bharata B Rao <[email protected]>
---
kernel/sched_rt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -77,7 +77,7 @@ static inline u64 sched_rt_period(struct
}

#define for_each_leaf_rt_rq(rt_rq, rq) \
- list_for_each_entry(rt_rq, &rq->leaf_rt_rq_list, leaf_rt_rq_list)
+ list_for_each_entry_rcu(rt_rq, &rq->leaf_rt_rq_list, leaf_rt_rq_list)

static inline struct rq *rq_of_rt_rq(struct rt_rq *rt_rq)
{

Regards,
Bharata.


2008-12-16 20:40:23

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH] sched: Use RCU variant of list traversal in for_each_leaf_rt_rq()


* Bharata B Rao <[email protected]> wrote:

> sched: Use RCU variant of list traversal in for_each_leaf_rt_rq()
>
> for_each_leaf_rt_rq() walks an RCU protected list (rq->leaf_rt_rq_list),
> but doesn't use list_for_each_entry_rcu(). Fix this.
>
> Signed-off-by: Bharata B Rao <[email protected]>
> ---
> kernel/sched_rt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

applied to tip/sched/urgent, thanks Bharata!

i'm wondering, have you observed a real crash, or did you find this via
code review?

Ingo

2008-12-17 02:35:23

by Bharata B Rao

[permalink] [raw]
Subject: Re: [PATCH] sched: Use RCU variant of list traversal in for_each_leaf_rt_rq()

On Tue, Dec 16, 2008 at 09:39:57PM +0100, Ingo Molnar wrote:
>
> * Bharata B Rao <[email protected]> wrote:
>
> > sched: Use RCU variant of list traversal in for_each_leaf_rt_rq()
> >
> > for_each_leaf_rt_rq() walks an RCU protected list (rq->leaf_rt_rq_list),
> > but doesn't use list_for_each_entry_rcu(). Fix this.
> >
> > Signed-off-by: Bharata B Rao <[email protected]>
> > ---
> > kernel/sched_rt.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
>
> applied to tip/sched/urgent, thanks Bharata!
>
> i'm wondering, have you observed a real crash, or did you find this via
> code review?

Via code review.

Thanks,
Bharata.