From: Lorenzo Stoakes <lstoakes@gmail.com>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Cc: Baoquan He <bhe@redhat.com>, Uladzislau Rezki <urezki@gmail.com>,
Christoph Hellwig <hch@infradead.org>,
Vlastimil Babka <vbabka@suse.cz>,
Lorenzo Stoakes <lstoakes@gmail.com>
Subject: [PATCH] mm/vmalloc: do not output a spurious warning when huge vmalloc() fails
Date: Mon, 5 Jun 2023 21:11:07 +0100 [thread overview]
Message-ID: <20230605201107.83298-1-lstoakes@gmail.com> (raw)
In __vmalloc_area_node() we always warn_alloc() when an allocation
performed by vm_area_alloc_pages() fails unless it was due to a pending
fatal signal.
However, huge page allocations instigated either by vmalloc_huge() or
__vmalloc_node_range() (or a caller that invokes this like kvmalloc() or
kvmalloc_node()) always falls back to order-0 allocations if the huge page
allocation fails.
This renders the warning useless and noisy, especially as all callers
appear to be aware that this may fallback. This has already resulted in at
least one bug report from a user who was confused by this (see link).
Therefore, simply update the code to only output this warning for order-0
pages when no fatal signal is pending.
Link: https://bugzilla.suse.com/show_bug.cgi?id=1211410
Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
---
mm/vmalloc.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index ab606a80f475..e563f40ad379 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -3149,11 +3149,20 @@ 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) {
- /* vm_area_alloc_pages() can also fail due to a fatal signal */
- if (!fatal_signal_pending(current))
+ /*
+ * vm_area_alloc_pages() can fail due to insufficient memory but
+ * also:-
+ *
+ * - a pending fatal signal
+ * - insufficient huge page-order pages
+ *
+ * Since we always retry allocations at order-0 in the huge page
+ * case a warning for either is spurious.
+ */
+ if (!fatal_signal_pending(current) && page_order == 0)
warn_alloc(gfp_mask, NULL,
- "vmalloc error: size %lu, page order %u, failed to allocate pages",
- area->nr_pages * PAGE_SIZE, page_order);
+ "vmalloc error: size %lu, failed to allocate pages",
+ area->nr_pages * PAGE_SIZE);
goto fail;
}
--
2.40.1
next reply other threads:[~2023-06-05 20:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 20:11 Lorenzo Stoakes [this message]
2023-06-05 20:26 ` [PATCH] mm/vmalloc: do not output a spurious warning when huge vmalloc() fails Vlastimil Babka
2023-06-06 1:13 ` Baoquan He
2023-06-06 7:13 ` Vlastimil Babka
2023-06-06 7:40 ` Lorenzo Stoakes
2023-06-07 8:58 ` Vlastimil Babka
2023-06-07 9:06 ` Lorenzo Stoakes
2023-06-07 16:33 ` Andrew Morton
2023-06-25 15:40 ` Forza
2023-06-25 15:59 ` Lorenzo Stoakes
2023-06-26 9:08 ` Vlastimil Babka
2023-06-26 14:09 ` Forza
2023-06-06 8:17 ` Uladzislau Rezki
2023-06-06 8:24 ` Lorenzo Stoakes
2023-06-06 8:40 ` Uladzislau Rezki
2023-06-06 7:34 ` David Hildenbrand
2023-06-06 8:21 ` Uladzislau Rezki
2023-06-06 16:11 ` Michal Hocko
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=20230605201107.83298-1-lstoakes@gmail.com \
--to=lstoakes@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=urezki@gmail.com \
--cc=vbabka@suse.cz \
/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