From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: [ofa-general] Re: [PATCH] mmu notifiers #v7 Date: Thu, 28 Feb 2008 16:56:08 -0800 Message-ID: <20080228165608.de7c8ae4.akpm@linux-foundation.org> References: <20080219084357.GA22249@wotan.suse.de> <20080219135851.GI7128@v2.random> <20080219231157.GC18912@wotan.suse.de> <20080220010941.GR7128@v2.random> <20080220103942.GU7128@v2.random> <20080221045430.GC15215@wotan.suse.de> <20080221144023.GC9427@v2.random> <20080221161028.GA14220@sgi.com> <20080227192610.GF28483@v2.random> <20080229004001.GN8091@v2.random> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Nick Piggin , Peter Zijlstra , linux-mm@kvack.org, Izik Eidus , Kanoj Sarcar , Roland Dreier , Jack Steiner , linux-kernel@vger.kernel.org, Avi Kivity , kvm-devel@lists.sourceforge.net, daniel.blueman@quadrics.com, Robin Holt , general@lists.openfabrics.org, Christoph Lameter To: Andrea Arcangeli Return-path: In-Reply-To: <20080229004001.GN8091@v2.random> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: general-bounces@lists.openfabrics.org Errors-To: general-bounces@lists.openfabrics.org List-Id: kvm.vger.kernel.org On Fri, 29 Feb 2008 01:40:01 +0100 Andrea Arcangeli 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.