]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
epoll: trim epitem by one cache line
authorEric Wong <normalperson@yhbt.net>
Wed, 20 Mar 2013 04:07:46 +0000 (15:07 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 20 Mar 2013 04:23:02 +0000 (15:23 +1100)
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

index 495d15558f42fed3ddeed399ed5ee6c30e301c01..0edf94dd578ec79ba92d128f6f8839decff3b9ca 100644 (file)
 struct epoll_filefd {
        struct file *file;
        int fd;
-};
+} EPOLL_PACKED;
 
 /*
  * Structure used to track possible nested calls, for too deep recursions