From: Eric Wong Date: Wed, 20 Mar 2013 04:07:47 +0000 (+1100) Subject: epoll: comment + BUILD_BUG_ON to prevent epitem bloat X-Git-Tag: next-20130321~2^2~251 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=bbd82176b69b96be179964d18984096ba3250acb;p=karo-tx-linux.git epoll: comment + BUILD_BUG_ON to prevent epitem bloat This will prevent us from accidentally introducing a memory bloat regression here in the future. 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 5cc010aa2e95..c30b016598a1 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -129,6 +129,8 @@ struct nested_calls { /* * Each file descriptor added to the eventpoll interface will * have an entry of this type linked to the "rbr" RB tree. + * Avoid increasing the size of this struct, there can be many thousands + * of these on a server and we do not want this to take another cache line. */ struct epitem { /* RB tree node used to link this structure to the eventpoll RB tree */ @@ -2011,6 +2013,12 @@ static int __init eventpoll_init(void) /* Initialize the structure used to perform file's f_op->poll() calls */ ep_nested_calls_init(&poll_readywalk_ncalls); + /* + * We can have many thousands of epitems, so prevent this from + * using an extra cache line on 64-bit (and smaller) CPUs + */ + BUILD_BUG_ON(sizeof(void *) <= 8 && sizeof(struct epitem) > 128); + /* Allocates slab cache used to allocate "struct epitem" items */ epi_cache = kmem_cache_create("eventpoll_epi", sizeof(struct epitem), 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);