linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH mm] mm/vmalloc: repair warn_alloc()s in __vmalloc_area_node()
@ 2021-09-15 11:43 Vasily Averin
  2021-09-15 13:52 ` Christoph Hellwig
  2021-09-16  6:01 ` Muchun Song
  0 siblings, 2 replies; 3+ messages in thread
From: Vasily Averin @ 2021-09-15 11:43 UTC (permalink / raw)
  To: Christoph Hellwig, Andrew Morton; +Cc: linux-mm, linux-kernel, kernel

Commit f255935b9767 ("mm: cleanup the gfp_mask handling in
__vmalloc_area_node") added __GFP_NOWARN to gfp_mask unconditionally
however it disabled all output inside warn_alloc() call.
This patch saves original gfp_mask and provides it to all warn_alloc() calls.

Fixes: f255935b9767 ("mm: cleanup the gfp_mask handling in __vmalloc_area_node")
Cc: Christoph Hellwig <hch@lst.de>

Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 mm/vmalloc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 551011399974..ff8538b1b28f 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2888,6 +2888,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
 				 int node)
 {
 	const gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO;
+	const gfp_t orig_gfp_mask = gfp_mask;
 	unsigned long addr = (unsigned long)area->addr;
 	unsigned long size = get_vm_area_size(area);
 	unsigned long array_size;
@@ -2908,7 +2909,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
 	}
 
 	if (!area->pages) {
-		warn_alloc(gfp_mask, NULL,
+		warn_alloc(orig_gfp_mask, NULL,
 			"vmalloc error: size %lu, failed to allocated page array size %lu",
 			nr_small_pages * PAGE_SIZE, array_size);
 		free_vm_area(area);
@@ -2928,7 +2929,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
 	 * allocation request, free them via __vfree() if any.
 	 */
 	if (area->nr_pages != nr_small_pages) {
-		warn_alloc(gfp_mask, NULL,
+		warn_alloc(orig_gfp_mask, NULL,
 			"vmalloc error: size %lu, page order %u, failed to allocate pages",
 			area->nr_pages * PAGE_SIZE, page_order);
 		goto fail;
@@ -2936,7 +2937,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
 
 	if (vmap_pages_range(addr, addr + size, prot, area->pages,
 			page_shift) < 0) {
-		warn_alloc(gfp_mask, NULL,
+		warn_alloc(orig_gfp_mask, NULL,
 			"vmalloc error: size %lu, failed to map pages",
 			area->nr_pages * PAGE_SIZE);
 		goto fail;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH mm] mm/vmalloc: repair warn_alloc()s in __vmalloc_area_node()
  2021-09-15 11:43 [PATCH mm] mm/vmalloc: repair warn_alloc()s in __vmalloc_area_node() Vasily Averin
@ 2021-09-15 13:52 ` Christoph Hellwig
  2021-09-16  6:01 ` Muchun Song
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2021-09-15 13:52 UTC (permalink / raw)
  To: Vasily Averin
  Cc: Christoph Hellwig, Andrew Morton, linux-mm, linux-kernel, kernel

On Wed, Sep 15, 2021 at 02:43:10PM +0300, Vasily Averin wrote:
> Commit f255935b9767 ("mm: cleanup the gfp_mask handling in
> __vmalloc_area_node") added __GFP_NOWARN to gfp_mask unconditionally
> however it disabled all output inside warn_alloc() call.
> This patch saves original gfp_mask and provides it to all warn_alloc() calls.
> 
> Fixes: f255935b9767 ("mm: cleanup the gfp_mask handling in __vmalloc_area_node")
> Cc: Christoph Hellwig <hch@lst.de>
> 
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>

Looks fine, thanks.

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH mm] mm/vmalloc: repair warn_alloc()s in __vmalloc_area_node()
  2021-09-15 11:43 [PATCH mm] mm/vmalloc: repair warn_alloc()s in __vmalloc_area_node() Vasily Averin
  2021-09-15 13:52 ` Christoph Hellwig
@ 2021-09-16  6:01 ` Muchun Song
  1 sibling, 0 replies; 3+ messages in thread
From: Muchun Song @ 2021-09-16  6:01 UTC (permalink / raw)
  To: Vasily Averin
  Cc: Christoph Hellwig, Andrew Morton, Linux Memory Management List,
	LKML, kernel

On Wed, Sep 15, 2021 at 7:43 PM Vasily Averin <vvs@virtuozzo.com> wrote:
>
> Commit f255935b9767 ("mm: cleanup the gfp_mask handling in
> __vmalloc_area_node") added __GFP_NOWARN to gfp_mask unconditionally
> however it disabled all output inside warn_alloc() call.
> This patch saves original gfp_mask and provides it to all warn_alloc() calls.
>
> Fixes: f255935b9767 ("mm: cleanup the gfp_mask handling in __vmalloc_area_node")
> Cc: Christoph Hellwig <hch@lst.de>
>
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>

LGTM. Thanks.

Reviewed-by: Muchun Song <songmuchun@bytedance.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-16  6:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-15 11:43 [PATCH mm] mm/vmalloc: repair warn_alloc()s in __vmalloc_area_node() Vasily Averin
2021-09-15 13:52 ` Christoph Hellwig
2021-09-16  6:01 ` Muchun Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).