i386 - pte update optimizations
cover i386 - pte update optimizations
Some PTE optimizations for native and paravirt-ops kernels; this provides a huge win for shadow mode hypervisors and gets rid of some unnecessary atomic instructions in native kernels, saving even more on UP by getting rid of implicit LOCK on xchg instruction.
Zach
Quoted 4 lines · Zachary Amsden
Some PTE optimizations for native and paravirt-ops kernels; this provides a huge win for shadow mode hypervisors and gets rid of some unnecessary atomic instructions in native kernels, saving even more on UP by getting rid of implicit LOCK on xchg instruction.
You do know that P6 and higher don't do locked bus references as long as the value is in the cache, right?
-hpa
Quoted 7 lines · H. Peter Anvin
Quoted 4 lines · Zachary Amsden
Some PTE optimizations for native and paravirt-ops kernels; this provides a huge win for shadow mode hypervisors and gets rid of some unnecessary atomic instructions in native kernels, saving even more on UP by getting rid of implicit LOCK on xchg instruction.
You do know that P6 and higher don't do locked bus references as long as the value is in the cache, right?
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.
Zach
Quoted 3 lines · Zachary Amsden
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.
kernel/sys.c +4 -2
@@ -2138,8 +2138,10 @@ asmlinkage long sys_getrusage(int who, sasmlinkage 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,
Quoted 3 lines · Eric Dumazet
Is there one processor that benefit from this patch then ?
At least P5 systems should benefit.
-hpa
Quoted 10 lines · Zachary Amsden
Quoted 2 lines
You do know that P6 and higher don't do locked bus references as long as the value is in the cache, right?
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.
LOCKed instruction suck really badly on the netburst microarchitecture (like factor of 10x, or not far off). I think it's probably because of their side effect of serialising memory accesses, causing horrible pipeline stalls.
-- Keir
Quoted 13 lines · Keir Fraser
Quoted 10 lines · Zachary Amsden
Quoted 2 lines
You do know that P6 and higher don't do locked bus references as long as the value is in the cache, right?
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.
Quoted 3 lines
LOCKed instruction suck really badly on the netburst microarchitecture (like factor of 10x, or not far off). I think it's probably because of their side effect of serialising memory accesses, causing horrible pipeline stalls.
Unfortunately they tend to be HyperThreaded usually (except for early ones and Celerons) and need the LOCK anyways.
-Andi
Quoted 6 lines · Andi Kleen
Quoted 3 lines
LOCKed instruction suck really badly on the netburst microarchitecture (like factor of 10x, or not far off). I think it's probably because of their side effect of serialising memory accesses, causing horrible pipeline stalls.
Unfortunately they tend to be HyperThreaded usually (except for early ones and Celerons) and need the LOCK anyways.
Fair point, although quite a few people disable HT.
-- Keir
Quoted 9 lines · Keir Fraser
Quoted 5 lines · Andi Kleen
Quoted 3 lines
LOCKed instruction suck really badly on the netburst microarchitecture (like factor of 10x, or not far off). I think it's probably because of their side effect of serialising memory accesses, causing horrible pipeline stalls.
Unfortunately they tend to be HyperThreaded usually (except for early ones and Celerons) and need the LOCK anyways.
Fair point, although quite a few people disable HT.
Note we're talking a UP-only hack.
-hpa