From 5b8749c4669e93dcafebc4c93aa1974c96ff43c7 Mon Sep 17 00:00:00 2001 From: Bob Glossman Date: Tue, 24 May 2016 11:16:35 -0700 Subject: [PATCH] LU-8196 obd: force very large allocations to use vmalloc In cases where the requsted allocation size is very large use OBD_VMALLOC(). This avoids warnings from el7 and newer kernels due to very large kmalloc()s. Signed-off-by: Bob Glossman Change-Id: I87e95b1f8e5e50bc35d713a1775313c10f0368a9 Reviewed-on: http://review.whamcloud.com/20420 Reviewed-by: John L. Hammond Reviewed-by: Yang Sheng Tested-by: Jenkins Reviewed-by: James Simmons Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/include/obd_support.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index f089bf3..81a32c7 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -749,7 +749,11 @@ do { \ #define OBD_ALLOC_LARGE(ptr, size) \ do { \ - OBD_ALLOC_GFP(ptr, size, GFP_NOFS | __GFP_NOWARN); \ + /* LU-8196 - force large allocations to use vmalloc, not kmalloc */ \ + if ((size) > KMALLOC_MAX_SIZE) \ + ptr = NULL; \ + else \ + OBD_ALLOC_GFP(ptr, size, GFP_NOFS | __GFP_NOWARN); \ if (ptr == NULL) \ OBD_VMALLOC(ptr, size); \ } while (0) -- 1.8.3.1