From: Eric Wong Date: Tue, 26 Mar 2013 23:25:06 +0000 (+1100) Subject: epoll: trim epitem by one cache line X-Git-Tag: next-20130404~3^2~294 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=23074fef0099385f44e2e0124300be68e72800e4;p=karo-tx-linux.git 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 Cc: Davide Libenzi Cc: Al Viro Signed-off-by: Andrew Morton --- diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 495d15558f42..0edf94dd578e 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -105,7 +105,7 @@ struct epoll_filefd { struct file *file; int fd; -}; +} EPOLL_PACKED; /* * Structure used to track possible nested calls, for too deep recursions