Re: [PATCH v2] mm: vmalloc: Avoid warn_alloc noise caused by fatal signal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 30 Mar 2023 16:26:25 +0000 Yafang Shao <laoar.shao@xxxxxxxxx> wrote:

> There're some suspicious warn_alloc on my test serer, for example,
> 
> [13366.518837] warn_alloc: 81 callbacks suppressed
> [13366.518841] test_verifier: vmalloc error: size 4096, page order 0, failed to allocate pages, mode:0x500dc2(GFP_HIGHUSER|__GFP_ZERO|__GFP_ACCOUNT), nodemask=(null),cpuset=/,mems_allowed=0-1
> [13366.522240] CPU: 30 PID: 722463 Comm: test_verifier Kdump: loaded Tainted: G        W  O       6.2.0+ #638
> [13366.524216] Call Trace:
> 
> ...
>
> This failure really confuse me as there're still lots of available
> pages. Finally I figured out it was caused by a fatal signal. When a
> process is allocating memory via vm_area_alloc_pages(), it will break
> directly even if it hasn't allocated the requested pages when it
> receives a fatal signal. In that case, we shouldn't show this warn_alloc,
> as it is useless. We only need to show this warning when there're really
> no enough pages.
> 
> ...
>
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -3024,9 +3024,11 @@ 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,
> -			"vmalloc error: size %lu, page order %u, failed to allocate pages",
> -			area->nr_pages * PAGE_SIZE, page_order);
> +		/* vm_area_alloc_pages() can also fail due to a fatal signal */
> +		if (!fatal_signal_pending(current))
> +			warn_alloc(gfp_mask, NULL,
> +				"vmalloc error: size %lu, page order %u, failed to allocate pages",
> +				area->nr_pages * PAGE_SIZE, page_order);
>  		goto fail;
>  	}

Emitting erroneous splats into dmesg is pretty unpleasant, so I'll put
a cc:stable on this one.  I can't identify a suitable Fixes: target -
the code around there has changed several times in fairly cosmetic
ways so each of the various -stable kernels will probably need different
versions of the patch.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux