1
0
Fork 0
remarkable-linux/arch
Ying Huang 966a967116 smp: Avoid using two cache lines for struct call_single_data
struct call_single_data is used in IPIs to transfer information between
CPUs.  Its size is bigger than sizeof(unsigned long) and less than
cache line size.  Currently it is not allocated with any explicit alignment
requirements.  This makes it possible for allocated call_single_data to
cross two cache lines, which results in double the number of the cache lines
that need to be transferred among CPUs.

This can be fixed by requiring call_single_data to be aligned with the
size of call_single_data. Currently the size of call_single_data is the
power of 2.  If we add new fields to call_single_data, we may need to
add padding to make sure the size of new definition is the power of 2
as well.

Fortunately, this is enforced by GCC, which will report bad sizes.

To set alignment requirements of call_single_data to the size of
call_single_data, a struct definition and a typedef is used.

To test the effect of the patch, I used the vm-scalability multiple
thread swap test case (swap-w-seq-mt).  The test will create multiple
threads and each thread will eat memory until all RAM and part of swap
is used, so that huge number of IPIs are triggered when unmapping
memory.  In the test, the throughput of memory writing improves ~5%
compared with misaligned call_single_data, because of faster IPIs.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Huang, Ying <ying.huang@intel.com>
[ Add call_single_data_t and align with size of call_single_data. ]
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Aaron Lu <aaron.lu@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/87bmnqd6lz.fsf@yhuang-mobile.sh.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-08-29 15:14:38 +02:00
..
alpha futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
arc futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
arm futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
arm64 futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
blackfin Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-07-21 10:41:19 -07:00
c6x Merge branch 'work.uaccess-unaligned' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2017-07-15 11:17:52 -07:00
cris Kbuild updates for v4.13 (2nd) 2017-07-13 13:37:57 -07:00
frv futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
h8300 h8300: Add missing closing parenthesis in flat_get_addr_from_rp() 2017-07-16 09:24:06 -07:00
hexagon futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
ia64 futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
m32r Merge branch 'work.uaccess-unaligned' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2017-07-15 11:17:52 -07:00
m68k blackfin, m68k: Fix flat_set_persistent() for unsigned long to u32 changes 2017-07-16 09:24:06 -07:00
metag locking/atomic: Fix atomic_set_release() for 'funny' architectures 2017-08-10 12:28:54 +02:00
microblaze futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
mips smp: Avoid using two cache lines for struct call_single_data 2017-08-29 15:14:38 +02:00
mn10300 Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-07-21 10:41:19 -07:00
nios2 nios2: move generic-y of exported headers to uapi/asm/Kbuild 2017-07-11 21:33:43 +09:00
openrisc futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
parisc futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
powerpc futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
s390 futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
score Merge branch 'uaccess.strlen' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2017-07-06 22:07:44 -07:00
sh futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
sparc futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
tile futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
um mm: fix MADV_[FREE|DONTNEED] TLB flush miss problem 2017-08-10 15:54:07 -07:00
unicore32 unicore32: move generic-y of exported headers to uapi/asm/Kbuild 2017-07-11 21:33:52 +09:00
x86 locking/refcounts, x86/asm: Disable CONFIG_ARCH_HAS_REFCOUNT for the time being 2017-08-29 13:10:35 +02:00
xtensa futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
.gitignore
Kconfig locking/refcounts, x86/asm: Implement fast refcount overflow protection 2017-08-17 10:40:26 +02:00