Messages in this thread | | | Subject | Re: [patch 1/9] EMM Notifier: The notifier calls | From | Peter Zijlstra <> | Date | Tue, 01 Apr 2008 23:14:40 +0200 |
| |
(Christoph, why are your CCs so often messed up?)
On Tue, 2008-04-01 at 13:55 -0700, Christoph Lameter wrote: > plain text document attachment (emm_notifier)
> +/* Register a notifier */ > +void emm_notifier_register(struct emm_notifier *e, struct mm_struct *mm) > +{ > + e->next = mm->emm_notifier; > + /* > + * The update to emm_notifier (e->next) must be visible > + * before the pointer becomes visible. > + * rcu_assign_pointer() does exactly what we need. > + */ > + rcu_assign_pointer(mm->emm_notifier, e); > +} > +EXPORT_SYMBOL_GPL(emm_notifier_register); > + > +/* Perform a callback */ > +int __emm_notify(struct mm_struct *mm, enum emm_operation op, > + unsigned long start, unsigned long end) > +{ > + struct emm_notifier *e = rcu_dereference(mm)->emm_notifier; > + int x; > + > + while (e) { > + > + if (e->callback) { > + x = e->callback(e, mm, op, start, end); > + if (x) > + return x; > + } > + /* > + * emm_notifier contents (e) must be fetched after > + * the retrival of the pointer to the notifier. > + */ > + e = rcu_dereference(e)->next; > + } > + return 0; > +} > +EXPORT_SYMBOL_GPL(__emm_notify); > +#endif
Those rcu_dereference()s are wrong. They should read:
e = rcu_dereference(mm->emm_notifier);
and
e = rcu_dereference(e->next);
| |