fs/seq_file: Use vmalloc by default for allocations > PAGE_SIZE

Some OOM implementations are pretty trigger happy when it comes to
releasing memory for kmalloc() allocations.  We might as well head
straight to vmalloc for allocations over PAGE_SIZE.

Bug: 17871993
Change-Id: Ic0dedbadc8bf551d34cc5d77c8073938d4adef80
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Naveen Ramaraj <nramaraj@codeaurora.org>
This commit is contained in:
Jordan Crouse 2014-09-10 10:09:53 -06:00 committed by Iliyan Malchev
parent ce1247b1e2
commit 5075f68b3f
1 changed files with 4 additions and 2 deletions

View File

@ -36,9 +36,11 @@ static void *seq_buf_alloc(unsigned long size)
{
void *buf;
buf = kmalloc(size, GFP_KERNEL | __GFP_NOWARN);
if (!buf && size > PAGE_SIZE)
if (size > PAGE_SIZE)
buf = vmalloc(size);
else
buf = kmalloc(size, GFP_KERNEL | __GFP_NOWARN);
return buf;
}