]> git.karo-electronics.de Git - karo-tx-linux.git/commit
epoll: trim epitem by one cache line
authorEric Wong <normalperson@yhbt.net>
Tue, 26 Mar 2013 23:25:06 +0000 (10:25 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 4 Apr 2013 06:12:29 +0000 (17:12 +1100)
commit23074fef0099385f44e2e0124300be68e72800e4
treebfb0da67951dfcaaa7fb4c49176adec83b299908
parent9aae7354a0f222c4fd08347456d52d2b91a79261
epoll: trim epitem by one cache line

It is common for epoll users to have thousands of epitems, so saving a
cache line on every allocation leads to large memory savings.

Since epitem allocations are cache-aligned, reducing sizeof(struct epitem)
from 136 bytes to 128 bytes will allow it to squeeze under a cache line
boundary on x86_64.

Via /sys/kernel/slab/eventpoll_epi, I see the following changes on my
x86_64 Core2 Duo (which has 64-byte cache alignment):

object_size  :  192 => 128
objs_per_slab:   21 =>  32

Also, add a BUILD_BUG_ON() to check for future accidental breakage.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Cc: Davide Libenzi <davidel@xmailserver.org>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/eventpoll.c