]> 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>
Tue, 2 Apr 2013 07:29:24 +0000 (18:29 +1100)
commitbf4e160db398ad0f9f676d380a28054ccdeaf3c2
tree98f61793b9ee7d25eb58d5e58f49e253e5081511
parent4ac5fc7b63999bbe5a83010d09e1860ede06329f
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