Re: [PATCH tip/core/rcu 06/13] sched: use lockdep-based checkingon rcu_dereference()

From: Peter Zijlstra
Date: Sun Feb 14 2010 - 05:13:07 EST


On Thu, 2010-02-11 at 16:00 -0800, Paul E. McKenney wrote:
> + first = rcu_dereference_check(pid->tasks[type].first, rcu_read_lock_held() || lockdep_is_held(&tasklist_lock));
> if (first)
> result = hlist_entry(first, struct task_struct, pids[(type)].node);
> }

I've seen that particular combination a few times in this patch, would
it make sense to create rcu_dereference_task()?

> diff --git a/kernel/sched.c b/kernel/sched.c
> index c535cc4..ad419d9 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -645,6 +645,11 @@ static inline int cpu_of(struct rq *rq)
> #endif
> }
>
> +#define for_each_domain_rd(p) \
> + rcu_dereference_check((p), \
> + rcu_read_lock_sched_held() || \
> + lockdep_is_held(&sched_domains_mutex))
> +

Would rcu_dereference_rd() not be a better name?


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/