* [PATCH] mm: allow __GFP_RETRY_MAYFAIL in vmalloc
@ 2026-02-12 16:33 Mikulas Patocka
2026-02-21 1:19 ` SeongJae Park
2026-02-23 19:02 ` Vishal Moola (Oracle)
0 siblings, 2 replies; 7+ messages in thread
From: Mikulas Patocka @ 2026-02-12 16:33 UTC (permalink / raw)
To: Vishal Moola
Cc: Christoph Hellwig, Uladzislau Rezki (Sony),
SeongJae Park, Andrew Morton, zkabelac, Matthew Sakai, linux-mm,
dm-devel
The commit 07003531e03c8 ("mm/vmalloc: warn on invalid vmalloc gfp
flags") breaks the device mapper VDO target. The VDO target calls vmalloc
with __GFP_RETRY_MAYFAIL and this flag is not in the mask of allowed
flags.
There is no reason why vmalloc couldn't support __GFP_RETRY_MAYFAIL, so
let's add this flag to GFP_VMALLOC_SUPPORTED.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Fixes: 07003531e03c ("mm/vmalloc: warn on invalid vmalloc gfp flags")
Cc: stable@vger.kernel.org # v6.19
---
mm/vmalloc.c | 1 +
1 file changed, 1 insertion(+)
Index: linux-2.6/mm/vmalloc.c
===================================================================
--- linux-2.6.orig/mm/vmalloc.c
+++ linux-2.6/mm/vmalloc.c
@@ -3928,6 +3928,7 @@ fail:
*/
#define GFP_VMALLOC_SUPPORTED (GFP_KERNEL | GFP_ATOMIC | GFP_NOWAIT |\
__GFP_NOFAIL | __GFP_ZERO | __GFP_NORETRY |\
+ __GFP_RETRY_MAYFAIL |\
GFP_NOFS | GFP_NOIO | GFP_KERNEL_ACCOUNT |\
GFP_USER | __GFP_NOLOCKDEP)
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] mm: allow __GFP_RETRY_MAYFAIL in vmalloc
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)
1 sibling, 1 reply; 7+ messages in thread
From: SeongJae Park @ 2026-02-21 1:19 UTC (permalink / raw)
To: Mikulas Patocka
Cc: SeongJae Park, Vishal Moola, Christoph Hellwig,
Uladzislau Rezki (Sony),
Andrew Morton, zkabelac, Matthew Sakai, linux-mm, dm-devel
On Thu, 12 Feb 2026 17:33:30 +0100 (CET) Mikulas Patocka <mpatocka@redhat.com> wrote:
> The commit 07003531e03c8 ("mm/vmalloc: warn on invalid vmalloc gfp
> flags") breaks the device mapper VDO target. The VDO target calls vmalloc
> with __GFP_RETRY_MAYFAIL and this flag is not in the mask of allowed
> flags.
>
> There is no reason why vmalloc couldn't support __GFP_RETRY_MAYFAIL, so
> let's add this flag to GFP_VMALLOC_SUPPORTED.
>
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
> Fixes: 07003531e03c ("mm/vmalloc: warn on invalid vmalloc gfp flags")
> Cc: stable@vger.kernel.org # v6.19
Acked-by: SeongJae Park <sj@kernel.org>
>
> ---
> mm/vmalloc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> Index: linux-2.6/mm/vmalloc.c
> ===================================================================
> --- linux-2.6.orig/mm/vmalloc.c
> +++ linux-2.6/mm/vmalloc.c
> @@ -3928,6 +3928,7 @@ fail:
> */
> #define GFP_VMALLOC_SUPPORTED (GFP_KERNEL | GFP_ATOMIC | GFP_NOWAIT |\
> __GFP_NOFAIL | __GFP_ZERO | __GFP_NORETRY |\
> + __GFP_RETRY_MAYFAIL |\
> GFP_NOFS | GFP_NOIO | GFP_KERNEL_ACCOUNT |\
> GFP_USER | __GFP_NOLOCKDEP)
By the way, I think this list might better to be alphabetically sorted in
future. Obviously just a trivial and random thought that never required for
this patch.
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] mm: allow __GFP_RETRY_MAYFAIL in vmalloc
2026-02-21 1:19 ` SeongJae Park
@ 2026-02-23 5:48 ` Anshuman Khandual
0 siblings, 0 replies; 7+ messages in thread
From: Anshuman Khandual @ 2026-02-23 5:48 UTC (permalink / raw)
To: SeongJae Park, Mikulas Patocka
Cc: Vishal Moola, Christoph Hellwig, Uladzislau Rezki (Sony),
Andrew Morton, zkabelac, Matthew Sakai, linux-mm, dm-devel
On 21/02/26 6:49 AM, SeongJae Park wrote:
> On Thu, 12 Feb 2026 17:33:30 +0100 (CET) Mikulas Patocka <mpatocka@redhat.com> wrote:
>
>> The commit 07003531e03c8 ("mm/vmalloc: warn on invalid vmalloc gfp
>> flags") breaks the device mapper VDO target. The VDO target calls vmalloc
>> with __GFP_RETRY_MAYFAIL and this flag is not in the mask of allowed
>> flags.
>>
>> There is no reason why vmalloc couldn't support __GFP_RETRY_MAYFAIL, so
>> let's add this flag to GFP_VMALLOC_SUPPORTED.
>>
>> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
>> Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
>> Fixes: 07003531e03c ("mm/vmalloc: warn on invalid vmalloc gfp flags")
>> Cc: stable@vger.kernel.org # v6.19
>
> Acked-by: SeongJae Park <sj@kernel.org>
>
>>
>> ---
>> mm/vmalloc.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> Index: linux-2.6/mm/vmalloc.c
>> ===================================================================
>> --- linux-2.6.orig/mm/vmalloc.c
>> +++ linux-2.6/mm/vmalloc.c
>> @@ -3928,6 +3928,7 @@ fail:
>> */
>> #define GFP_VMALLOC_SUPPORTED (GFP_KERNEL | GFP_ATOMIC | GFP_NOWAIT |\
>> __GFP_NOFAIL | __GFP_ZERO | __GFP_NORETRY |\
>> + __GFP_RETRY_MAYFAIL |\
>> GFP_NOFS | GFP_NOIO | GFP_KERNEL_ACCOUNT |\
>> GFP_USER | __GFP_NOLOCKDEP)
>
> By the way, I think this list might better to be alphabetically sorted in
Agreed.
> future. Obviously just a trivial and random thought that never required for
> this patch.
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm: allow __GFP_RETRY_MAYFAIL in vmalloc
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 19:02 ` Vishal Moola (Oracle)
2026-02-23 19:25 ` Mikulas Patocka
1 sibling, 1 reply; 7+ messages in thread
From: Vishal Moola (Oracle) @ 2026-02-23 19:02 UTC (permalink / raw)
To: Mikulas Patocka
Cc: Christoph Hellwig, Uladzislau Rezki (Sony),
SeongJae Park, Andrew Morton, zkabelac, Matthew Sakai, linux-mm,
dm-devel
On Thu, Feb 12, 2026 at 05:33:30PM +0100, Mikulas Patocka wrote:
> The commit 07003531e03c8 ("mm/vmalloc: warn on invalid vmalloc gfp
> flags") breaks the device mapper VDO target. The VDO target calls vmalloc
> with __GFP_RETRY_MAYFAIL and this flag is not in the mask of allowed
> flags.
>
> There is no reason why vmalloc couldn't support __GFP_RETRY_MAYFAIL, so
> let's add this flag to GFP_VMALLOC_SUPPORTED.
My only skepticism about this comes from the line in the
vmalloc_node_range() doc:
"and %__GFP_RETRY_MAYFAIL are not supported."
I myself don't know why that may be. Could you elaborate on if/why the
doc is wrong please?
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
> Fixes: 07003531e03c ("mm/vmalloc: warn on invalid vmalloc gfp flags")
> Cc: stable@vger.kernel.org # v6.19
>
> ---
> mm/vmalloc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> Index: linux-2.6/mm/vmalloc.c
> ===================================================================
> --- linux-2.6.orig/mm/vmalloc.c
> +++ linux-2.6/mm/vmalloc.c
> @@ -3928,6 +3928,7 @@ fail:
> */
> #define GFP_VMALLOC_SUPPORTED (GFP_KERNEL | GFP_ATOMIC | GFP_NOWAIT |\
> __GFP_NOFAIL | __GFP_ZERO | __GFP_NORETRY |\
> + __GFP_RETRY_MAYFAIL |\
> GFP_NOFS | GFP_NOIO | GFP_KERNEL_ACCOUNT |\
> GFP_USER | __GFP_NOLOCKDEP)
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] mm: allow __GFP_RETRY_MAYFAIL in vmalloc
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
0 siblings, 2 replies; 7+ messages in thread
From: Mikulas Patocka @ 2026-02-23 19:25 UTC (permalink / raw)
To: Vishal Moola (Oracle), Michal Hocko
Cc: Christoph Hellwig, Uladzislau Rezki (Sony),
SeongJae Park, Andrew Morton, zkabelac, Matthew Sakai, linux-mm,
dm-devel
On Mon, 23 Feb 2026, Vishal Moola (Oracle) wrote:
> On Thu, Feb 12, 2026 at 05:33:30PM +0100, Mikulas Patocka wrote:
> > The commit 07003531e03c8 ("mm/vmalloc: warn on invalid vmalloc gfp
> > flags") breaks the device mapper VDO target. The VDO target calls vmalloc
> > with __GFP_RETRY_MAYFAIL and this flag is not in the mask of allowed
> > flags.
> >
> > There is no reason why vmalloc couldn't support __GFP_RETRY_MAYFAIL, so
> > let's add this flag to GFP_VMALLOC_SUPPORTED.
>
> My only skepticism about this comes from the line in the
> vmalloc_node_range() doc:
> "and %__GFP_RETRY_MAYFAIL are not supported."
>
> I myself don't know why that may be. Could you elaborate on if/why the
> doc is wrong please?
This statement was added by Michal Hocko in the commit
b7d90e7a5ea8d64e668d5685925900d33d3884d5. Michal, could you explain why do
you think that __GFP_RETRY_MAYFAIL is not supported?
The VDO module needs to allocate large amounts of memory and it doesn't
want to trigger the OOM killer (which would kill some innocent task and
wouldn't solve the out of memory condition at all), so I think that
__GFP_RETRY_MAYFAIL is appropriate.
Mikulas
> > Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> > Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
> > Fixes: 07003531e03c ("mm/vmalloc: warn on invalid vmalloc gfp flags")
> > Cc: stable@vger.kernel.org # v6.19
> >
> > ---
> > mm/vmalloc.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > Index: linux-2.6/mm/vmalloc.c
> > ===================================================================
> > --- linux-2.6.orig/mm/vmalloc.c
> > +++ linux-2.6/mm/vmalloc.c
> > @@ -3928,6 +3928,7 @@ fail:
> > */
> > #define GFP_VMALLOC_SUPPORTED (GFP_KERNEL | GFP_ATOMIC | GFP_NOWAIT |\
> > __GFP_NOFAIL | __GFP_ZERO | __GFP_NORETRY |\
> > + __GFP_RETRY_MAYFAIL |\
> > GFP_NOFS | GFP_NOIO | GFP_KERNEL_ACCOUNT |\
> > GFP_USER | __GFP_NOLOCKDEP)
> >
> >
>
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] mm: allow __GFP_RETRY_MAYFAIL in vmalloc
2026-02-23 19:25 ` Mikulas Patocka
@ 2026-02-23 20:07 ` Uladzislau Rezki
2026-02-23 22:08 ` Michal Hocko
1 sibling, 0 replies; 7+ messages in thread
From: Uladzislau Rezki @ 2026-02-23 20:07 UTC (permalink / raw)
To: Mikulas Patocka
Cc: Vishal Moola (Oracle),
Michal Hocko, Christoph Hellwig, Uladzislau Rezki (Sony),
SeongJae Park, Andrew Morton, zkabelac, Matthew Sakai, linux-mm,
dm-devel
On Mon, Feb 23, 2026 at 08:25:38PM +0100, Mikulas Patocka wrote:
>
>
> On Mon, 23 Feb 2026, Vishal Moola (Oracle) wrote:
>
> > On Thu, Feb 12, 2026 at 05:33:30PM +0100, Mikulas Patocka wrote:
> > > The commit 07003531e03c8 ("mm/vmalloc: warn on invalid vmalloc gfp
> > > flags") breaks the device mapper VDO target. The VDO target calls vmalloc
> > > with __GFP_RETRY_MAYFAIL and this flag is not in the mask of allowed
> > > flags.
> > >
> > > There is no reason why vmalloc couldn't support __GFP_RETRY_MAYFAIL, so
> > > let's add this flag to GFP_VMALLOC_SUPPORTED.
> >
> > My only skepticism about this comes from the line in the
> > vmalloc_node_range() doc:
> > "and %__GFP_RETRY_MAYFAIL are not supported."
> >
> > I myself don't know why that may be. Could you elaborate on if/why the
> > doc is wrong please?
>
> This statement was added by Michal Hocko in the commit
> b7d90e7a5ea8d64e668d5685925900d33d3884d5. Michal, could you explain why do
> you think that __GFP_RETRY_MAYFAIL is not supported?
>
> The VDO module needs to allocate large amounts of memory and it doesn't
> want to trigger the OOM killer (which would kill some innocent task and
> wouldn't solve the out of memory condition at all), so I think that
> __GFP_RETRY_MAYFAIL is appropriate.
>
I do not see any problems using this with vmalloc from the first glance.
KASAN path was hard-coded when it comes to GFP but it is not anymore.
--
Uladzislau Rezki
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] mm: allow __GFP_RETRY_MAYFAIL in vmalloc
2026-02-23 19:25 ` Mikulas Patocka
2026-02-23 20:07 ` Uladzislau Rezki
@ 2026-02-23 22:08 ` Michal Hocko
1 sibling, 0 replies; 7+ messages in thread
From: Michal Hocko @ 2026-02-23 22:08 UTC (permalink / raw)
To: Mikulas Patocka
Cc: Vishal Moola (Oracle), Christoph Hellwig, Uladzislau Rezki (Sony),
SeongJae Park, Andrew Morton, zkabelac, Matthew Sakai, linux-mm,
dm-devel
On Mon 23-02-26 20:25:38, Mikulas Patocka wrote:
>
>
> On Mon, 23 Feb 2026, Vishal Moola (Oracle) wrote:
>
> > On Thu, Feb 12, 2026 at 05:33:30PM +0100, Mikulas Patocka wrote:
> > > The commit 07003531e03c8 ("mm/vmalloc: warn on invalid vmalloc gfp
> > > flags") breaks the device mapper VDO target. The VDO target calls vmalloc
> > > with __GFP_RETRY_MAYFAIL and this flag is not in the mask of allowed
> > > flags.
> > >
> > > There is no reason why vmalloc couldn't support __GFP_RETRY_MAYFAIL, so
> > > let's add this flag to GFP_VMALLOC_SUPPORTED.
> >
> > My only skepticism about this comes from the line in the
> > vmalloc_node_range() doc:
> > "and %__GFP_RETRY_MAYFAIL are not supported."
> >
> > I myself don't know why that may be. Could you elaborate on if/why the
> > doc is wrong please?
>
> This statement was added by Michal Hocko in the commit
> b7d90e7a5ea8d64e668d5685925900d33d3884d5. Michal, could you explain why do
> you think that __GFP_RETRY_MAYFAIL is not supported?
The problem with __GFP_RETRY_MAYFAIL is that it cannot be fully
supported. While pages that back the allocation can be easily made aware
of this failure mode there are page table allocations which are
hardocded GFP_KERNEL and there is no sensible way to extend the API to
change that (as we have learned several time over years).
> The VDO module needs to allocate large amounts of memory and it doesn't
> want to trigger the OOM killer (which would kill some innocent task and
> wouldn't solve the out of memory condition at all), so I think that
> __GFP_RETRY_MAYFAIL is appropriate.
Understood. But as said the very page table allocation could be the
trigger for the unwanted OOM. The same applies to __GFP_NORETRY
unfortunately as well. vmalloc has just recently gained support of
GFP_NOWAIT allocation mode, though. This will make the allocation
failure much more likely though so I am not entirely sure this is a
proper solution for your problem.
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-02-23 22:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox