From: Uladzislau Rezki <urezki@gmail.com>
To: Michal Hocko <mhocko@suse.com>
Cc: Uladzislau Rezki <urezki@gmail.com>,
Mikulas Patocka <mpatocka@redhat.com>,
"Vishal Moola (Oracle)" <vishal.moola@gmail.com>,
Christoph Hellwig <hch@infradead.org>,
SeongJae Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
zkabelac@redhat.com, Matthew Sakai <msakai@redhat.com>,
linux-mm@kvack.org, dm-devel@lists.linux.dev
Subject: Re: [PATCH] mm: allow __GFP_RETRY_MAYFAIL in vmalloc
Date: Tue, 24 Feb 2026 17:07:43 +0100 [thread overview]
Message-ID: <aZ3MzxtMp2OykAQq@pc636> (raw)
In-Reply-To: <aZ3JB5Xm3SCmJW95@tiehlicka>
On Tue, Feb 24, 2026 at 04:51:35PM +0100, Michal Hocko wrote:
> On Tue 24-02-26 16:44:43, Michal Hocko wrote:
> > On Tue 24-02-26 16:38:01, Uladzislau Rezki wrote:
> [...]
> > > I do not have a strong opinion about workaround you noted. Maybe Mikulas
> > > can switch to NOWAIT flag instead.
> >
> > using NOWAIT for the full vmalloc allocation would be just too easy to
> > fail under moderate memory pressure.
> >
> > The real question is whether we want to provide some sort of backoff
> > early but not way too easily allocation semantic for vmalloc. If yes we
> > need to get creative in the vmalloc internals rather than expect callers
> > to be working around that on their side. History has proven that this
> > just leads to tech. dept and more work later on.
>
> Just to make sure we are on the same page I mean something like this
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 61caa55a4402..791366fe44e2 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -3798,6 +3798,8 @@ static void defer_vm_area_cleanup(struct vm_struct *area)
> * non-blocking (no __GFP_DIRECT_RECLAIM) - memalloc_noreclaim_save()
> * GFP_NOFS - memalloc_nofs_save()
> * GFP_NOIO - memalloc_noio_save()
> + * __GFP_RETRY_MAYFAIL, __GFP_NORETRY - memalloc_noreclaim_save() to prevent
> + * OOMs
> *
> * Returns a flag cookie to pair with restore.
> */
> @@ -3806,7 +3808,7 @@ memalloc_apply_gfp_scope(gfp_t gfp_mask)
> {
> unsigned int flags = 0;
>
> - if (!gfpflags_allow_blocking(gfp_mask))
> + if (!gfpflags_allow_blocking(gfp_mask) || (gfp_mask & (__GFP_RETRY_MAYFAIL|__GFP_NORETRY)))
> flags = memalloc_noreclaim_save();
> else if ((gfp_mask & (__GFP_FS | __GFP_IO)) == __GFP_IO)
> flags = memalloc_nofs_save();
> @@ -3940,7 +3942,8 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
> * GFP_KERNEL_ACCOUNT. Xfs uses __GFP_NOLOCKDEP.
> */
> #define GFP_VMALLOC_SUPPORTED (GFP_KERNEL | GFP_ATOMIC | GFP_NOWAIT |\
> - __GFP_NOFAIL | __GFP_ZERO | __GFP_NORETRY |\
> + __GFP_NOFAIL | __GFP_ZERO | |\
> + __GFP_NORETRY | __GFP_RETRY_MAYFAIL |\
> GFP_NOFS | GFP_NOIO | GFP_KERNEL_ACCOUNT |\
> GFP_USER | __GFP_NOLOCKDEP)
>
> @@ -3971,12 +3974,15 @@ static gfp_t vmalloc_fix_flags(gfp_t flags)
> * virtual range with protection @prot.
> *
> * Supported GFP classes: %GFP_KERNEL, %GFP_ATOMIC, %GFP_NOWAIT,
> - * %GFP_NOFS and %GFP_NOIO. Zone modifiers are not supported.
> + * %__GFP_RETRY_MAYFAIL, %__GFP_NORETRY, %GFP_NOFS and %GFP_NOIO.
> + * Zone modifiers are not supported.
> * Please note %GFP_ATOMIC and %GFP_NOWAIT are supported only
> * by __vmalloc().
> *
> - * Retry modifiers: only %__GFP_NOFAIL is supported; %__GFP_NORETRY
> - * and %__GFP_RETRY_MAYFAIL are not supported.
> + * Retry modifiers: only %__GFP_NOFAIL is fully supported;
> + * %__GFP_NORETRY and %__GFP_RETRY_MAYFAIL are supported with limitation,
> + * i.e. page tables are allocated with NOWAIT semantic so they might fail
> + * under moderate memory pressure.
> *
> * %__GFP_NOWARN can be used to suppress failure messages.
> *
>
Yep, i got your intention correctly. It would eliminate the problem
with page tables allocations :)
--
Uladzislau Rezki
next prev parent reply other threads:[~2026-02-24 16:07 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 16:33 [PATCH] mm: allow __GFP_RETRY_MAYFAIL in vmalloc Mikulas Patocka
2026-02-21 1:19 ` SeongJae Park
2026-02-23 5:48 ` Anshuman Khandual
2026-02-23 19:02 ` Vishal Moola (Oracle)
2026-02-23 19:25 ` Mikulas Patocka
2026-02-23 20:07 ` Uladzislau Rezki
2026-02-23 22:08 ` Michal Hocko
2026-02-24 11:39 ` Uladzislau Rezki
2026-02-24 12:22 ` Michal Hocko
2026-02-24 14:03 ` Christoph Hellwig
2026-02-24 14:22 ` Shakeel Butt
2026-02-24 14:26 ` Christoph Hellwig
2026-02-24 14:34 ` Michal Hocko
2026-03-02 17:33 ` Mikulas Patocka
2026-02-24 15:38 ` Uladzislau Rezki
2026-02-24 15:44 ` Michal Hocko
2026-02-24 15:51 ` Michal Hocko
2026-02-24 16:07 ` Uladzislau Rezki [this message]
2026-02-25 8:33 ` Uladzislau Rezki
2026-02-25 11:46 ` Michal Hocko
2026-03-02 9:50 ` Uladzislau Rezki
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=aZ3MzxtMp2OykAQq@pc636 \
--to=urezki@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dm-devel@lists.linux.dev \
--cc=hch@infradead.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=mpatocka@redhat.com \
--cc=msakai@redhat.com \
--cc=sj@kernel.org \
--cc=vishal.moola@gmail.com \
--cc=zkabelac@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.