[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1304749801.2821.716.camel@edumazet-laptop>
Date: Sat, 07 May 2011 08:30:01 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Alexander Viro <viro@...iv.linux.org.uk>
Cc: Matthew Wilcox <matthew@....cx>, linux-fsdevel@...r.kernel.org,
Arnd Bergmann <arnd@...db.de>,
linux-kernel <linux-kernel@...r.kernel.org>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Changli Gao <xiaosuo@...il.com>
Subject: [PATCH] fs: avoid unecessary smp_wmb() in dup_fd()
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>
Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
Cc: Matthew Wilcox <matthew@....cx>
Cc: linux-fsdevel@...r.kernel.org
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Changli Gao <xiaosuo@...il.com>
Cc: Paul E. McKenney <paulmck@...ux.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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists