From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755726AbZBCSYZ (ORCPT ); Tue, 3 Feb 2009 13:24:25 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751525AbZBCSYN (ORCPT ); Tue, 3 Feb 2009 13:24:13 -0500 Received: from x35.xmailserver.org ([64.71.152.41]:55842 "EHLO x35.xmailserver.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751384AbZBCSYL (ORCPT ); Tue, 3 Feb 2009 13:24:11 -0500 X-AuthUser: davidel@xmailserver.org Date: Tue, 3 Feb 2009 10:24:03 -0800 (PST) From: Davide Libenzi X-X-Sender: davide@alien.or.mcafeemobile.com To: Andrew Morton cc: Linux Kernel Mailing List , Linus Torvalds , Alan Cox , Ingo Molnar , David Miller Subject: Re: [patch 2/6] epoll keyed wakeups v2 - introduce new *_poll() wakeup macros In-Reply-To: <20090203001401.cc960d4e.akpm@linux-foundation.org> Message-ID: References: <20090203001401.cc960d4e.akpm@linux-foundation.org> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) X-GPG-FINGRPRINT: CFAE 5BEE FD36 F65E E640 56FE 0974 BF23 270F 474E X-GPG-PUBLIC_KEY: http://www.xmailserver.org/davidel.asc MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 3 Feb 2009, Andrew Morton wrote: > On Sun, 01 Feb 2009 12:04:23 -0800 Davide Libenzi wrote: > > > +#define wake_up_nested_poll(x, m, s) \ > > +do { \ > > + unsigned long flags; \ > > + \ > > + spin_lock_irqsave_nested(&(x)->lock, flags, (s)); \ > > + wake_up_locked_poll(x, m); \ > > + spin_unlock_irqrestore(&(x)->lock, flags); \ > > +} while (0) > > I had to go and find the callsite to work out the type of `x' :( > > - this macro can be passed the address of any structure which has a > `spinlock_t lock;' in it, which seems strange. > > - It references its first arg three times. > > Is there any reason why we can't implement this in C? I don't see any reason why these two couldn't be normal functions (I just referenced wake_up_nested(), that was a macro in the first place). Probably even un-inlined? - Davide