On Fri, 29 Feb 2008 01:40:01 +0100 Andrea Arcangeli <[EMAIL PROTECTED]> wrote:

> > > +#define mmu_notifier(function, mm, args...)                              
> > > \
> > > + do {                                                            \
> > > +         struct mmu_notifier *__mn;                              \
> > > +         struct hlist_node *__n;                                 \
> > > +                                                                 \
> > > +         if (unlikely(!hlist_empty(&(mm)->mmu_notifier.head))) { \
> > > +                 rcu_read_lock();                                \
> > > +                 hlist_for_each_entry_rcu(__mn, __n,             \
> > > +                                          &(mm)->mmu_notifier.head, \
> > > +                                          hlist)                 \
> > > +                         if (__mn->ops->function)                \
> > > +                                 __mn->ops->function(__mn,       \
> > > +                                                     mm,         \
> > > +                                                     args);      \
> > > +                 rcu_read_unlock();                              \
> > > +         }                                                       \
> > > + } while (0)
> > 
> > Andrew recomended local variables for parameters used multile times. This 
> > means the mm parameter here.
> 
> I don't exactly see what "buggy macro" meant?

multiple refernces to the argument, so

        mmu_notifier(foo, bar(), zot);

will call bar() either once or twice.

Unlikely in this case, but bad practice.  Easily fixable by using another
temporary.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to