Files
linux/arch/x86/include/asm
Avi Kivity e422a4a5d6 x86-64, rwsem: Avoid store forwarding hazard in __downgrade_write
commit 0d1622d7f5 upstream.

The Intel Architecture Optimization Reference Manual states that a short
load that follows a long store to the same object will suffer a store
forwading penalty, particularly if the two accesses use different addresses.
Trivially, a long load that follows a short store will also suffer a penalty.

__downgrade_write() in rwsem incurs both penalties:  the increment operation
will not be able to reuse a recently-loaded rwsem value, and its result will
not be reused by any recently-following rwsem operation.

A comment in the code states that this is because 64-bit immediates are
special and expensive; but while they are slightly special (only a single
instruction allows them), they aren't expensive: a test shows that two loops,
one loading a 32-bit immediate and one loading a 64-bit immediate, both take
1.5 cycles per iteration.

Fix this by changing __downgrade_write to use the same add instruction on
i386 and on x86_64, so that it uses the same operand size as all the other
rwsem functions.

Signed-off-by: Avi Kivity <avi@redhat.com>
LKML-Reference: <1266049992-17419-1-git-send-email-avi@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-04-26 07:41:28 -07:00
..
2009-09-20 20:25:03 +02:00
2009-08-08 17:44:11 +02:00
2009-08-27 17:12:52 +02:00
2009-06-11 23:31:52 +02:00
2009-06-11 23:31:52 +02:00
2010-03-15 08:50:07 -07:00
2009-08-31 09:35:45 +02:00
2009-06-13 15:37:30 +02:00
2010-04-26 07:41:20 -07:00
2009-09-10 10:46:49 +03:00
2009-09-10 08:33:12 +03:00
2009-07-30 16:03:46 +09:30
2009-05-18 09:21:04 +02:00
2009-08-31 11:09:40 +02:00
2010-04-26 07:41:27 -07:00
2009-09-20 20:18:57 +02:00
2009-06-15 12:40:02 +02:00
2010-01-18 10:19:11 -08:00
2009-09-22 19:57:51 -07:00
2010-01-18 10:19:11 -08:00
2009-07-19 18:27:52 +02:00
2009-09-20 20:19:34 +02:00
2009-08-21 21:43:46 +02:00
2009-06-15 12:40:02 +02:00