Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756214AbZF2Rcj (ORCPT ); Mon, 29 Jun 2009 13:32:39 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754076AbZF2Rc2 (ORCPT ); Mon, 29 Jun 2009 13:32:28 -0400 Received: from mail-fx0-f218.google.com ([209.85.220.218]:58375 "EHLO mail-fx0-f218.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752761AbZF2Rc0 (ORCPT ); Mon, 29 Jun 2009 13:32:26 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=iXzPTQRSLyqnSC932QpHHxk3E5J+ClakcO7DDjoRsGQ1XtZmYQMniXZ5RDaexbeOxE i31uLZN/W6rlZZUeoZ4Bm4gfm22yDRAZCxiqGGO9julT8BsWxCmvAIt8r/1Eb+RX0LzF g1+6uY+S8NW0XC17EolerHo4ZEWYIYr1/ueDc= Date: Mon, 29 Jun 2009 19:32:17 +0200 From: Jarek Poplawski To: Davide Libenzi Cc: Jiri Olsa , netdev@vger.kernel.org, Linux Kernel Mailing List , fbl@redhat.com, nhorman@redhat.com, davem@redhat.com, htejun@gmail.com, oleg@redhat.com, eric.dumazet@gmail.com Subject: Re: [PATCH 1/2] net: adding memory barrier to the poll and receive callbacks Message-ID: <20090629173217.GC2742@ami.dom.local> References: <20090629140434.GE3845@jolsa.lab.eng.brq.redhat.com> <20090629141445.GF3845@jolsa.lab.eng.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1614 Lines: 47 On Mon, Jun 29, 2009 at 08:34:55AM -0700, Davide Libenzi wrote: > On Mon, 29 Jun 2009, Jiri Olsa wrote: > > > -static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) > > +static inline void __poll_wait(struct file *filp, > > + wait_queue_head_t *wait_address, poll_table *p) > > +{ > > + p->qproc(filp, wait_address, p); > > +} > > + > > +static inline void poll_wait(struct file *filp, > > + wait_queue_head_t *wait_address, poll_table *p) > > { > > if (p && wait_address) > > - p->qproc(filp, wait_address, p); > > + __poll_wait(filp, wait_address, p); > > } > > > +static inline void sock_poll_wait(struct file *filp, struct sock *sk, > > + poll_table *p) > > +{ > > + if (p && sk->sk_sleep) { > > + __poll_wait(filp, sk->sk_sleep, p); > > + /* > > + * We need to be sure we are in sync with the > > + * socket flags modification. > > + * > > + * This memory barrier is paired in the sk_has_sleeper. > > + */ > > + smp_mb(); > > + } > > +} > > I think Oleg already said this, but you can use directly poll_wait() > without adding another abstraction, and the compiler will drop the double > check for you: I think Oleg told about cosmetics and let Jiri to choose. I'd only add it's not mainly about optimization, but easy showing the main difference, of course depending on taste. Jarek P. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/