> When a memory allocation for array of pages are not succeed > emit a warning message as a first step and then perform the > further cleanup. > > Signed-off-by: Uladzislau Rezki (Sony) <urezki@xxxxxxxxx> > --- > Makefile | 2 +- > mm/vmalloc.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/Makefile b/Makefile > index bb50a5ac2e13..1d658e171495 100644 > --- a/Makefile > +++ b/Makefile > @@ -430,7 +430,7 @@ HOSTCXX = g++ > endif > > export KBUILD_USERCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \ > - -O2 -fomit-frame-pointer -std=gnu89 > + -O0 -g -fomit-frame-pointer -std=gnu89 > export KBUILD_USERLDFLAGS := > > KBUILD_HOSTCFLAGS := $(KBUILD_USERCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS) > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index dbc6744400d5..1f664a17d9ea 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -2781,11 +2781,11 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, > } > > if (!area->pages) { > - free_vm_area(area); > warn_alloc(gfp_mask, NULL, > "vmalloc size %lu allocation failure: " > "page array size %lu allocation failed", > nr_small_pages * PAGE_SIZE, array_size); > + free_vm_area(area); > return NULL; > } > > -- > 2.20.1 > Please consider a V3 of this patch. Apparently a modification of Makefile was included in the patch. What is wrong :) >From 9c484d83a630c4430dcb055a26c879d8e3c5cae1 Mon Sep 17 00:00:00 2001 From: "Uladzislau Rezki (Sony)" <urezki@xxxxxxxxx> Date: Sat, 8 May 2021 23:41:21 +0200 Subject: [PATCH v3 2/2] mm/vmalloc: Print a warning message first on failure When a memory allocation for array of pages are not succeed emit a warning message as a first step and then perform the further cleanup. Signed-off-by: Uladzislau Rezki (Sony) <urezki@xxxxxxxxx> --- mm/vmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index dbc6744400d5..1f664a17d9ea 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2781,11 +2781,11 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, } if (!area->pages) { - free_vm_area(area); warn_alloc(gfp_mask, NULL, "vmalloc size %lu allocation failure: " "page array size %lu allocation failed", nr_small_pages * PAGE_SIZE, array_size); + free_vm_area(area); return NULL; } -- 2.20.1 -- Vlad Rezki