vfs: avoid large kmalloc()s for the fdtable
authorAndrew Morton <akpm@linux-foundation.org>
Wed, 27 Apr 2011 22:26:41 +0000 (15:26 -0700)
committerSteve Conklin <sconklin@canonical.com>
Thu, 2 Jun 2011 19:23:06 +0000 (14:23 -0500)
commit23789df10c658c04f2610b62b74af2a27f98414c
tree6ab35c4e3bddcef6fa866cba1baa28784971bbdf
parente350f7cf12149a8c79095268e1b6da14901fa754
vfs: avoid large kmalloc()s for the fdtable

BugLink: http://bugs.launchpad.net/bugs/775809

commit 6d4831c283530a5f2c6bd8172c13efa236eb149d upstream.

Azurit reports large increases in system time after 2.6.36 when running
Apache.  It was bisected down to a892e2d7dcdfa6c76e6 ("vfs: use kmalloc()
to allocate fdmem if possible").

That patch caused the vfs to use kmalloc() for very large allocations and
this is causing excessive work (and presumably excessive reclaim) within
the page allocator.

Fix it by falling back to vmalloc() earlier - when the allocation attempt
would have been considered "costly" by reclaim.

Reported-by: azurIt <azurit@pobox.sk>
Tested-by: azurIt <azurit@pobox.sk>
Acked-by: Changli Gao <xiaosuo@gmail.com>
Cc: Americo Wang <xiyou.wangcong@gmail.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
fs/file.c