From: Bob Glossman Date: Tue, 24 May 2016 18:16:35 +0000 (-0700) Subject: LU-8196 obd: force very large allocations to use vmalloc X-Git-Tag: 2.8.55~23 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=5b8749c4669e93dcafebc4c93aa1974c96ff43c7 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 --- 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)