[Cbe-oss-dev] [PATCH] spufs: avoid spurious memory barriers

Christoph Hellwig hch at lst.de
Fri Apr 6 01:38:15 EST 2007


We now have proper locking around assignets of the mapping pointers,
and the spin_unlock implies enough of a barrier to get rid of the
explicit one.


Signed-off-by: Christoph Hellwig <hch at lst.de>

Index: linux-2.6/arch/powerpc/platforms/cell/spufs/file.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/spufs/file.c	2007-04-05 09:37:22.000000000 +0200
+++ linux-2.6/arch/powerpc/platforms/cell/spufs/file.c	2007-04-05 09:37:44.000000000 +0200
@@ -50,7 +50,6 @@ spufs_mem_open(struct inode *inode, stru
 	if (!i->i_openers++)
 		ctx->local_store = inode->i_mapping;
 	spin_unlock(&ctx->mapping_lock);
-	smp_wmb();
 	return 0;
 }
 
@@ -64,7 +63,6 @@ spufs_mem_release(struct inode *inode, s
 	if (!--i->i_openers)
 		ctx->local_store = NULL;
 	spin_unlock(&ctx->mapping_lock);
-	smp_wmb();
 	return 0;
 }
 
@@ -317,7 +315,6 @@ static int spufs_cntl_open(struct inode 
 	if (!i->i_openers++)
 		ctx->cntl = inode->i_mapping;
 	spin_unlock(&ctx->mapping_lock);
-	smp_wmb();
 	return simple_attr_open(inode, file, spufs_cntl_get,
 					spufs_cntl_set, "0x%08lx");
 }
@@ -334,7 +331,6 @@ spufs_cntl_release(struct inode *inode, 
 	if (!--i->i_openers)
 		ctx->cntl = NULL;
 	spin_unlock(&ctx->mapping_lock);
-	smp_wmb();
 	return 0;
 }
 
@@ -822,7 +818,6 @@ static int spufs_signal1_open(struct ino
 	if (!i->i_openers++)
 		ctx->signal1 = inode->i_mapping;
 	spin_unlock(&ctx->mapping_lock);
-	smp_wmb();
 	return nonseekable_open(inode, file);
 }
 
@@ -836,7 +831,6 @@ spufs_signal1_release(struct inode *inod
 	if (!--i->i_openers)
 		ctx->signal1 = NULL;
 	spin_unlock(&ctx->mapping_lock);
-	smp_wmb();
 	return 0;
 }
 
@@ -948,7 +942,6 @@ static int spufs_signal2_open(struct ino
 	if (!i->i_openers++)
 		ctx->signal2 = inode->i_mapping;
 	spin_unlock(&ctx->mapping_lock);
-	smp_wmb();
 	return nonseekable_open(inode, file);
 }
 
@@ -962,7 +955,6 @@ spufs_signal2_release(struct inode *inod
 	if (!--i->i_openers)
 		ctx->signal2 = NULL;
 	spin_unlock(&ctx->mapping_lock);
-	smp_wmb();
 	return 0;
 }
 
@@ -1167,7 +1159,6 @@ static int spufs_mss_open(struct inode *
 	if (!i->i_openers++)
 		ctx->mss = inode->i_mapping;
 	spin_unlock(&ctx->mapping_lock);
-	smp_wmb();
 	return nonseekable_open(inode, file);
 }
 
@@ -1181,7 +1172,6 @@ spufs_mss_release(struct inode *inode, s
 	if (!--i->i_openers)
 		ctx->mss = NULL;
 	spin_unlock(&ctx->mapping_lock);
-	smp_wmb();
 	return 0;
 }
 
@@ -1227,7 +1217,6 @@ static int spufs_psmap_open(struct inode
 	if (!i->i_openers++)
 		ctx->psmap = inode->i_mapping;
 	spin_unlock(&ctx->mapping_lock);
-	smp_wmb();
 	return nonseekable_open(inode, file);
 }
 
@@ -1241,7 +1230,6 @@ spufs_psmap_release(struct inode *inode,
 	if (!--i->i_openers)
 		ctx->psmap = NULL;
 	spin_unlock(&ctx->mapping_lock);
-	smp_wmb();
 	return 0;
 }
 
@@ -1299,7 +1287,6 @@ static int spufs_mfc_open(struct inode *
 	if (!i->i_openers++)
 		ctx->mfc = inode->i_mapping;
 	spin_unlock(&ctx->mapping_lock);
-	smp_wmb();
 	return nonseekable_open(inode, file);
 }
 
@@ -1313,7 +1300,6 @@ spufs_mfc_release(struct inode *inode, s
 	if (!--i->i_openers)
 		ctx->mfc = NULL;
 	spin_unlock(&ctx->mapping_lock);
-	smp_wmb();
 	return 0;
 }
 



More information about the cbe-oss-dev mailing list