Re: [PATCH] 3/4 combine RCU with seqlock to allow mmu notifier methods to sleep (#v9 was 1/4)

Peter Zijlstra
2008-03-07T16:53:17Z

On Fri, 2008-03-07 at 16:23 +0100, Andrea Arcangeli wrote:

> @@ -42,11 +45,19 @@ int __mmu_notifier_clear_flush_young(str
> struct mmu_notifier *mn;
> struct hlist_node *n;
> int young = 0;
> + unsigned seq;
>
> rcu_read_lock();
> +restart:
> + seq = read_seqbegin(&mm->mmu_notifier_lock);
> hlist_for_each_entry_rcu(mn, n, &mm->mmu_notifier_list, hlist) {
> - if (mn->ops->clear_flush_young)
> + if (mn->ops->clear_flush_young) {

hlist_del_rcu(&mn->hlist)

> + rcu_read_unlock();

kfree(mn);

> young |= mn->ops->clear_flush_young(mn, mm, address);

*BANG*

> + rcu_read_lock();
> + }
> + if (read_seqretry(&mm->mmu_notifier_lock, seq))
> + goto restart;
> }
> rcu_read_unlock();