x86: cache pollution aware __copy_from_user_ll()
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Linux Kernel Mailing List
commit
c22ce143d15eb288543fe9873e1c5ac1c01b69a1
treedc7d457b8952fc50dfc90df659b35de4117c61fc
parent7dbdf43cfa635ddc3701cc8d1eab07597cd731c0
author Hiro Yoshioka <[email protected]> Fri, 23 Jun 2006 16:04:16 -0700 committer Linus Torvalds <[email protected]> Fri, 23 Jun 2006 21:42:56 -0700[PATCH] x86: cache pollution aware
__copy_from_user_ll()Use the x86 cache-bypassing copy instructions for
copy_from_user().
Quoted 7 lines
Some performance data are
Total of
GLOBAL_POWER_EVENTS(CPU cycle samples)2.6.12.4.orig 1921587
2.6.12.4.nt 1599424
1599424/1921587=83.23% (16.77% reduction)
Hi,
while this patch will reduce the number of cycles spent in the kernel, it's just pushing the cache miss to userspace (by virtue of doing a cache flush effectively)... is this really the right thing? The total memory bandwidth will actually increase with this patch if you're unlucky (eg if userspace decides to write to this memory eventually)....
Greetings,
Arjan van de Ven
Quoted 19 lines · Arjan van de Ven
Quoted 10 lines · Linux Kernel Mailing List
commit
c22ce143d15eb288543fe9873e1c5ac1c01b69a1
treedc7d457b8952fc50dfc90df659b35de4117c61fc
parent7dbdf43cfa635ddc3701cc8d1eab07597cd731c0
author Hiro Yoshioka <[email protected]> Fri, 23 Jun 2006 16:04:16 -0700 committer Linus Torvalds <[email protected]> Fri, 23 Jun 2006 21:42:56 -0700[PATCH] x86: cache pollution aware
__copy_from_user_ll()Use the x86 cache-bypassing copy instructions for
copy_from_user().Quoted 7 lines
Some performance data are
Total of
GLOBAL_POWER_EVENTS(CPU cycle samples)2.6.12.4.orig 1921587
2.6.12.4.nt 1599424
1599424/1921587=83.23% (16.77% reduction)
Quoted 7 lines
Hi,
while this patch will reduce the number of cycles spent in the kernel, it's just pushing the cache miss to userspace (by virtue of doing a cache flush effectively)... is this really the right thing? The total memory bandwidth will actually increase with this patch if you're unlucky (eg if userspace decides to write to this memory eventually)....
But this is a copy _from_ userspace. The userspace app has likely already brought it into cache before we do the __copy_from_user_ll
Dave
Signature · 1 line
http://www.codemonkey.org.uk
Quoted 6 lines · Arjan van de Ven
while this patch will reduce the number of cycles spent in the kernel, it's just pushing the cache miss to userspace (by virtue of doing a cache flush effectively)... is this really the right thing? The total memory bandwidth will actually increase with this patch if you're unlucky (eg if userspace decides to write to this memory eventually)....
No. It's for copying _from_ user space, ie a "write()" system call. So what it does is to effectively try to use non-temporal stores to the page cache - since the page cache is usually not read directly afterwards (at least not soon enough for L1 caches to help).
I don't generally like cache tricks either (caches tend to be better than humans, or at least get there fairly soon), but this one does seem very valid.
Linus
Quoted 10 lines · Linus Torvalds
Quoted 6 lines · Arjan van de Ven
while this patch will reduce the number of cycles spent in the kernel, it's just pushing the cache miss to userspace (by virtue of doing a cache flush effectively)... is this really the right thing? The total memory bandwidth will actually increase with this patch if you're unlucky (eg if userspace decides to write to this memory eventually)....
No. It's for copying _from_ user space, ie a "
write()" system call.
eh DOH
never mind
Quoted 8 lines · Linus Torvalds
Quoted 6 lines · Arjan van de Ven
while this patch will reduce the number of cycles spent in the kernel, it's just pushing the cache miss to userspace (by virtue of doing a cache flush effectively)... is this really the right thing? The total memory bandwidth will actually increase with this patch if you're unlucky (eg if userspace decides to write to this memory eventually)....
Quoted 8 lines
No. It's for copying _from_ user space, ie a "
write()" system call. So what it does is to effectively try to use non-temporal stores to the page cache - since the page cache is usually not read directly afterwards (at least not soon enough for L1 caches to help).I don't generally like cache tricks either (caches tend to be better than humans, or at least get there fairly soon), but this one does seem very valid.
Problem is that it will likely wreck pipe and AF_UNIX (= X server) performance. These read the buffer quickly again.
If you do something like this it would be better to define a special function and use it for real FS traffic only.
-Andi
Quoted 3 lines · Andi Kleen
Problem is that it will likely wreck pipe and
AF_UNIX(= X server) performance. These read the buffer quickly again.
Look at the patch, dammit!
Quoted 2 lines
If you do something like this it would be better to define a special function and use it for real FS traffic only.
Has anybody taken even a five-second look at the patch itself, or are you all just complaining without knowing what you're complaining about?
Linus