From: Alexander Zarochentsev Date: Tue, 6 Dec 2022 17:10:41 +0000 (+0300) Subject: LU-16387 lustre: switch OBD_ALLOC_LARGE to vmalloc faster X-Git-Tag: 2.15.54~125 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F80%2F49380%2F3;p=fs%2Flustre-release.git LU-16387 lustre: switch OBD_ALLOC_LARGE to vmalloc faster No need to waste time trying hard to kmalloc large memory chunk in OBD_ALLOC_LARGE. Reduce memory allocation attempts by specifiying __GFP_NORETRY for all allocations > PAGE_SIZE (as in kvmalloc in linux-4.18 kernel), so the kmalloc part fails easily. HPE-bug-id: LUS-11409 Signed-off-by: Alexander Zarochentsev Change-Id: I7ff8acfb6b467a4f5a7e61b2b8ec631bea89f8a5 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49380 Reviewed-by: Andrew Perepechko Reviewed-by: Alex Zhuravlev Reviewed-by: Nikitas Angelinas Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index bf26027..3ef800b 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -882,10 +882,11 @@ do { \ #define OBD_ALLOC_LARGE(ptr, size) \ do { \ /* LU-8196 - force large allocations to use vmalloc, not kmalloc */ \ - if ((size) > KMALLOC_MAX_SIZE) \ + if ((size) > KMALLOC_MAX_SIZE) \ ptr = NULL; \ - else \ - OBD_ALLOC_GFP(ptr, size, GFP_NOFS | __GFP_NOWARN); \ + else \ + OBD_ALLOC_GFP(ptr, size, GFP_NOFS | __GFP_NOWARN | \ + (((size) > PAGE_SIZE) ? __GFP_NORETRY : 0)); \ if (ptr == NULL) \ OBD_VMALLOC(ptr, size); \ } while (0)