Whamcloud - gitweb
LU-8196 obd: force very large allocations to use vmalloc 20/20420/3
authorBob Glossman <bob.glossman@intel.com>
Tue, 24 May 2016 18:16:35 +0000 (11:16 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 14 Jun 2016 03:55:49 +0000 (03:55 +0000)
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 <bob.glossman@intel.com>
Change-Id: I87e95b1f8e5e50bc35d713a1775313c10f0368a9
Reviewed-on: http://review.whamcloud.com/20420
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Tested-by: Jenkins
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/obd_support.h

index f089bf3..81a32c7 100644 (file)
@@ -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)