netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: Jiri Olsa <jolsa@redhat.com>,
	netdev@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	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
Date: Mon, 29 Jun 2009 19:32:17 +0200	[thread overview]
Message-ID: <20090629173217.GC2742@ami.dom.local> (raw)
In-Reply-To: <alpine.DEB.1.10.0906290826300.29966@makko.or.mcafeemobile.com>

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. 

  reply	other threads:[~2009-06-29 17:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-29 14:04 [PATCH 0/2] net: fix race in the receive/select Jiri Olsa
2009-06-29 14:14 ` [PATCH 1/2] net: adding memory barrier to the poll and receive callbacks Jiri Olsa
2009-06-29 15:34   ` Davide Libenzi
2009-06-29 17:32     ` Jarek Poplawski [this message]
2009-06-29 17:36       ` Davide Libenzi
2009-06-29 18:04         ` Jarek Poplawski
2009-06-29 18:14           ` Jarek Poplawski
2009-06-29 19:47             ` Jarek Poplawski
2009-06-29 20:17         ` Jiri Olsa
2009-06-29 20:20           ` Davide Libenzi
2009-06-29 17:19   ` Jarek Poplawski
2009-06-29 20:05     ` Jiri Olsa
2009-06-29 17:47   ` Jarek Poplawski
2009-06-29 14:15 ` [PATCH 2/2] memory barrier: adding smp_mb__after_lock Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090629173217.GC2742@ami.dom.local \
    --to=jarkao2@gmail.com \
    --cc=davem@redhat.com \
    --cc=davidel@xmailserver.org \
    --cc=eric.dumazet@gmail.com \
    --cc=fbl@redhat.com \
    --cc=htejun@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=oleg@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).