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 <alexander.zarochentsev@hpe.com>
Change-Id: I7ff8acfb6b467a4f5a7e61b2b8ec631bea89f8a5
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49380
Reviewed-by: Andrew Perepechko <andrew.perepechko@hpe.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Nikitas Angelinas <nikitas.angelinas@hpe.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
#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)