From: Andrew Morton <akpm@linux-foundation.org>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: urezki@gmail.com, hch@infradead.org, lstoakes@gmail.com,
linux-mm@kvack.org
Subject: Re: [PATCH v2] mm: vmalloc: Avoid warn_alloc noise caused by fatal signal
Date: Thu, 30 Mar 2023 12:33:07 -0700 [thread overview]
Message-ID: <20230330123307.c3cf460997b4c4e1dfc9bd66@linux-foundation.org> (raw)
In-Reply-To: <20230330162625.13604-1-laoar.shao@gmail.com>
On Thu, 30 Mar 2023 16:26:25 +0000 Yafang Shao <laoar.shao@gmail.com> 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.
prev parent reply other threads:[~2023-03-30 19:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 16:26 Yafang Shao
2023-03-30 19:33 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230330123307.c3cf460997b4c4e1dfc9bd66@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=laoar.shao@gmail.com \
--cc=linux-mm@kvack.org \
--cc=lstoakes@gmail.com \
--cc=urezki@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox