From: Andreas Dilger Date: Wed, 25 Jul 2018 05:36:18 +0000 (-0600) Subject: LU-11163 libcfs: fix CPT NUMA memory failures X-Git-Tag: 2.12.0-RC1~120 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=1ca7f6329833d551f69fd8aec29b66845bedb0c9 LU-11163 libcfs: fix CPT NUMA memory failures In some (mis-)configurations, NUMA nodes may not have any local RAM, or the memory allocations are non-uniform between NUMA nodes. In the unlikely case that a CPT-bound allocation fails, retry the allocation without the CPT-binding. Having some remote memory usage is better than an allocation failure. Signed-off-by: Andreas Dilger Change-Id: Ib0ab84bef8ff10c43bafb48a8082b62fc544ca29 Reviewed-on: https://review.whamcloud.com/32848 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Patrick Farrell Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index e9dd33e..f84c3a5 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -752,11 +752,13 @@ static inline void obd_memory_sub(long size) #define __OBD_MALLOC_VERBOSE(ptr, cptab, cpt, size, flags) \ do { \ - (ptr) = (cptab) == NULL ? \ - kmalloc(size, (flags) | __GFP_ZERO) : \ - cfs_cpt_malloc(cptab, cpt, size, (flags) | __GFP_ZERO); \ - if (likely((ptr) != NULL)) \ - OBD_ALLOC_POST(ptr, size, "kmalloced"); \ + if (cptab) \ + ptr = cfs_cpt_malloc((cptab), (cpt), (size), \ + (flags) | __GFP_ZERO | __GFP_NOWARN); \ + if (!(cptab) || unlikely(!(ptr))) /* retry without CPT if failure */ \ + ptr = kmalloc(size, (flags) | __GFP_ZERO); \ + if (likely((ptr) != NULL)) \ + OBD_ALLOC_POST((ptr), (size), "kmalloced"); \ } while (0) #define OBD_ALLOC_GFP(ptr, size, gfp_mask) \