Zachary Amsden a écrit :
Yes. Even then, last time I clocked instructions, xchg was still slower
than read / write, although I could be misremembering. And it's not
totally clear that they will always be in cached state, however, and for
SMP, we still want to drop the implicit lock in cases where the
processor might not know they are cached exclusive, but we know there
are no other racing users. And there are plenty of old processors out
there to still make it worthwhile.
Is there one processor that benefit from this patch then ?
I couldnt get a win on my test machines, maybe they are not old enough ;)
umask() doesnt need xchg() atomic semantic. If several threads are using
umask() concurrently results are not guaranted anyway.
--- linux-2.6.21-rc6/kernel/sys.c
+++ linux-2.6.21-rc6-ed/kernel/sys.c
@@ -2138,8 +2138,10 @@ asmlinkage long sys_getrusage(int who, s
asmlinkage long sys_umask(int mask)
{
- mask = xchg(¤t->fs->umask, mask & S_IRWXUGO);
- return mask;
+ struct fs_struct *fs = current->fs;
+ int old = fs->umask;
+ fs->umask = mask & S_IRWXUGO;
+ return old;
}
asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]