From: Vadim Lobanov This is a performance optimization for the fdtable code. When expanding the fdtable for a task, we want to allocate at least L1_CACHE_BYTES for the new fdset memory -- this will ensure that the fdsets of two different tasks will not share the same cacheline, causing lots of cacheline ping-pongs. Signed-off-by: Vadim Lobanov Signed-off-by: Andrew Morton --- fs/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff -puN fs/file.c~fdtable-implement-new-pagesize-based-fdtable-allocator-avoid-fdset-cacheline-ping-pong fs/file.c --- a/fs/file.c~fdtable-implement-new-pagesize-based-fdtable-allocator-avoid-fdset-cacheline-ping-pong +++ a/fs/file.c @@ -156,7 +156,8 @@ static struct fdtable * alloc_fdtable(un if (!data) goto out_fdt; fdt->fd = (struct file **)data; - data = alloc_fdmem(2 * nr / BITS_PER_BYTE); + data = alloc_fdmem(max_t(unsigned int, + 2 * nr / BITS_PER_BYTE, L1_CACHE_BYTES)); if (!data) goto out_arr; fdt->open_fds = (fd_set *)data; _