From 5075f68b3f423edb6e61e7b8a7c098a699eab151 Mon Sep 17 00:00:00 2001 From: Jordan Crouse Date: Wed, 10 Sep 2014 10:09:53 -0600 Subject: [PATCH] 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 Signed-off-by: Naveen Ramaraj --- fs/seq_file.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/seq_file.c b/fs/seq_file.c index df5e89002ee2..03f46abf8930 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c @@ -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; }