Re: [RFC][PATCH 6/7] lockdep: Maintain rw_state entries in locklist

From: Yong Zhang
Date: Mon Apr 18 2011 - 09:37:58 EST


On Sun, Apr 17, 2011 at 11:45:11AM +0200, Peter Zijlstra wrote:
> From: Gautham R Shenoy <ego@xxxxxxxxxx>
>
> The dependencies are currently maintained using a structure named
> locklist. For a dependency A --> B, it saves B's lock_class in an
> entry that would be linked to A's locks_after list.
>
> However, in order to make use of the split chains introduced in the
> previous patch, we need to enhance this infrastructure to save the
> read/write states of A and B for each dependency such that we might
> distinguish between the read and write chains.
>
> Signed-off-by: Gautham R Shenoy <ego@xxxxxxxxxx>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
> ---
> include/linux/lockdep.h | 6 ++++++
> kernel/lockdep.c | 23 +++++++++++++++++------
> 2 files changed, 23 insertions(+), 6 deletions(-)
>
> @@ -1690,6 +1694,8 @@ check_prev_add(struct task_struct *curr,
> if (entry->dep_class == hlock_class(next)) {
> if (distance == 1)
> entry->distance = 1;
> + entry->this_lock_rw_state |= prev->rw_state;
> + entry->dep_lock_rw_state |= next->rw_state;

If we could do this and return,

> return 2;
> }
> }
> @@ -1697,19 +1703,24 @@ check_prev_add(struct task_struct *curr,
> if (!trylock_loop && !save_trace(&trace))
> return 0;
>
> + list_for_each_entry(entry, &hlock_class(next)->locks_before, entry) {
> + if (entry->dep_class == hlock_class(prev)) {
> + entry->this_lock_rw_state |= next->rw_state;
> + entry->dep_lock_rw_state |= prev->rw_state;
> + }
> + }
> +

Do we have any change to do above?

Or am I missing something?

Thanks,
Yong
--
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/