All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	Matthew Wilcox <matthew@wil.cx>,
	linux-fsdevel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Changli Gao <xiaosuo@gmail.com>
Subject: Re: [PATCH] fs: avoid unecessary smp_wmb() in dup_fd()
Date: Sun, 8 May 2011 07:26:23 -0700	[thread overview]
Message-ID: <20110508142623.GO2641@linux.vnet.ibm.com> (raw)
In-Reply-To: <1304749801.2821.716.camel@edumazet-laptop>

On Sat, May 07, 2011 at 08:30:01AM +0200, Eric Dumazet wrote:
> While copying old_fds array to new_fds, we dont need
> rcu_assign_pointer() and its smp_wmb(), since we are the only thread
> populating new_fds at this point.
> 
> A bit later, rcu_assign_pointer(newf->fdt, new_fdt) makes sure
> our writes are committed to memory before new_fds content is visible to
> other threads.
> 
> This removes following sparse warning :
> 
> fs/file.c:371:3: warning: incorrect type in assignment (different
> address spaces)
> fs/file.c:371:3:    expected struct file *<noident>
> fs/file.c:371:3:    got struct file [noderef] <asn:4>*<noident>

Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Matthew Wilcox <matthew@wil.cx>
> Cc: linux-fsdevel@vger.kernel.org
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Changli Gao <xiaosuo@gmail.com>
> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
>  fs/file.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/file.c b/fs/file.c
> index 4c6992d..8320a8e 100644
> --- a/fs/file.c
> +++ b/fs/file.c
> @@ -368,7 +368,7 @@ struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
>  			 */
>  			FD_CLR(open_files - i, new_fdt->open_fds);
>  		}
> -		rcu_assign_pointer(*new_fds++, f);
> +		*new_fds++ = f;
>  	}
>  	spin_unlock(&oldf->file_lock);
> 
> 
> 

      reply	other threads:[~2011-05-08 14:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-07  6:30 [PATCH] fs: avoid unecessary smp_wmb() in dup_fd() Eric Dumazet
2011-05-08 14:26 ` Paul E. McKenney [this message]

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=20110508142623.GO2641@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=arnd@arndb.de \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xiaosuo@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.