lkml.org 
[lkml]   [2009]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] net: adding memory barrier to the poll and receive callbacks
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.


\
 
 \ /
  Last update: 2009-06-29 19:35    [W:0.042 / U:5.848 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site