* [PATCH] mm: remove out-dated document of __GFP_NOFAIL
@ 2026-08-27 3:05 Wei Yang
2026-08-27 7:35 ` Vlastimil Babka (SUSE)
0 siblings, 1 reply; 5+ messages in thread
From: Wei Yang @ 2026-08-27 3:05 UTC (permalink / raw)
To: akpm, david, ljs, liam, vbabka, rppt, surenb, mhocko,
brendan.jackman, hannes, ziy
Cc: linux-mm, linux-kernel, Wei Yang, Baokun Li
Commit ee040cbd6e48 ("mm/page_alloc: don't warn about large allocations
with __GFP_NOFAIL") remove a warning on allocating large folio with
__GFP_NOFAIL, which is adjusted by commit 903edea6c53f ("mm: warn about
illegal __GFP_NOFAIL usage in a more appropriate location and manner").
While in that commit, it also documented this behavior which is
out-dated now.
Adjust the document to align to current code, and adjust the comment
while at it.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Cc: Baokun Li <libaokun1@huawei.com>
---
include/linux/gfp_types.h | 2 --
mm/page_alloc.c | 2 +-
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/include/linux/gfp_types.h b/include/linux/gfp_types.h
index 190191411009..24fde8eb73df 100644
--- a/include/linux/gfp_types.h
+++ b/include/linux/gfp_types.h
@@ -243,8 +243,6 @@ enum {
* used only when there is no reasonable failure policy) but it is
* definitely preferable to use the flag rather than opencode endless
* loop around allocator.
- * Allocating pages from the buddy with __GFP_NOFAIL and order > 1 is
- * not supported. Please consider using kvmalloc() instead.
*/
#define __GFP_IO ((__force gfp_t)___GFP_IO)
#define __GFP_FS ((__force gfp_t)___GFP_FS)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ab385bc252cc..146f7e0a9462 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4804,7 +4804,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
if (unlikely(nofail)) {
/*
- * Also we don't support __GFP_NOFAIL without __GFP_DIRECT_RECLAIM,
+ * We don't support __GFP_NOFAIL without __GFP_DIRECT_RECLAIM,
* otherwise, we may result in lockup.
*/
WARN_ON_ONCE(!can_direct_reclaim);
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: remove out-dated document of __GFP_NOFAIL
2026-08-27 3:05 [PATCH] mm: remove out-dated document of __GFP_NOFAIL Wei Yang
@ 2026-08-27 7:35 ` Vlastimil Babka (SUSE)
2026-08-27 7:49 ` Wei Yang
0 siblings, 1 reply; 5+ messages in thread
From: Vlastimil Babka (SUSE) @ 2026-08-27 7:35 UTC (permalink / raw)
To: Wei Yang, akpm, david, ljs, liam, rppt, surenb, mhocko,
brendan.jackman, hannes, ziy
Cc: linux-mm, linux-kernel, Baokun Li
On 8/27/26 5:05 AM, Wei Yang wrote:
> Commit ee040cbd6e48 ("mm/page_alloc: don't warn about large allocations
> with __GFP_NOFAIL") remove a warning on allocating large folio with
> __GFP_NOFAIL, which is adjusted by commit 903edea6c53f ("mm: warn about
> illegal __GFP_NOFAIL usage in a more appropriate location and manner").
"which is adjusted by commit" sounds as 903edea6c53f came later than
ee040cbd6e48, but it's the opposite. Maybe say "which was placed there"?
> While in that commit, it also documented this behavior which is
> out-dated now.
>
> Adjust the document to align to current code, and adjust the comment
> while at it.
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> Cc: Baokun Li <libaokun1@huawei.com>
> ---
> include/linux/gfp_types.h | 2 --
> mm/page_alloc.c | 2 +-
> 2 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/include/linux/gfp_types.h b/include/linux/gfp_types.h
> index 190191411009..24fde8eb73df 100644
> --- a/include/linux/gfp_types.h
> +++ b/include/linux/gfp_types.h
> @@ -243,8 +243,6 @@ enum {
> * used only when there is no reasonable failure policy) but it is
> * definitely preferable to use the flag rather than opencode endless
> * loop around allocator.
> - * Allocating pages from the buddy with __GFP_NOFAIL and order > 1 is
> - * not supported. Please consider using kvmalloc() instead.
I'm not sure if we want to simply remove the lines, or rather say it's
discouraged (instead of not supported) and still suggest kvmalloc() if
possible.
> */
> #define __GFP_IO ((__force gfp_t)___GFP_IO)
> #define __GFP_FS ((__force gfp_t)___GFP_FS)
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index ab385bc252cc..146f7e0a9462 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -4804,7 +4804,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
>
> if (unlikely(nofail)) {
> /*
> - * Also we don't support __GFP_NOFAIL without __GFP_DIRECT_RECLAIM,
> + * We don't support __GFP_NOFAIL without __GFP_DIRECT_RECLAIM,
> * otherwise, we may result in lockup.
> */
> WARN_ON_ONCE(!can_direct_reclaim);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: remove out-dated document of __GFP_NOFAIL
2026-08-27 7:35 ` Vlastimil Babka (SUSE)
@ 2026-08-27 7:49 ` Wei Yang
2026-08-27 8:03 ` Vlastimil Babka (SUSE)
0 siblings, 1 reply; 5+ messages in thread
From: Wei Yang @ 2026-08-27 7:49 UTC (permalink / raw)
To: Vlastimil Babka (SUSE)
Cc: Wei Yang, akpm, david, ljs, liam, rppt, surenb, mhocko,
brendan.jackman, hannes, ziy, linux-mm, linux-kernel, Baokun Li
On Thu, Aug 27, 2026 at 09:35:26AM +0200, Vlastimil Babka (SUSE) wrote:
>On 8/27/26 5:05 AM, Wei Yang wrote:
>> Commit ee040cbd6e48 ("mm/page_alloc: don't warn about large allocations
>> with __GFP_NOFAIL") remove a warning on allocating large folio with
>> __GFP_NOFAIL, which is adjusted by commit 903edea6c53f ("mm: warn about
>> illegal __GFP_NOFAIL usage in a more appropriate location and manner").
>
>"which is adjusted by commit" sounds as 903edea6c53f came later than
>ee040cbd6e48, but it's the opposite. Maybe say "which was placed there"?
>
Got it.
>> While in that commit, it also documented this behavior which is
>> out-dated now.
>>
>> Adjust the document to align to current code, and adjust the comment
>> while at it.
>>
>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>> Cc: Baokun Li <libaokun1@huawei.com>
>> ---
>> include/linux/gfp_types.h | 2 --
>> mm/page_alloc.c | 2 +-
>> 2 files changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/include/linux/gfp_types.h b/include/linux/gfp_types.h
>> index 190191411009..24fde8eb73df 100644
>> --- a/include/linux/gfp_types.h
>> +++ b/include/linux/gfp_types.h
>> @@ -243,8 +243,6 @@ enum {
>> * used only when there is no reasonable failure policy) but it is
>> * definitely preferable to use the flag rather than opencode endless
>> * loop around allocator.
>> - * Allocating pages from the buddy with __GFP_NOFAIL and order > 1 is
>> - * not supported. Please consider using kvmalloc() instead.
>
>I'm not sure if we want to simply remove the lines, or rather say it's
>discouraged (instead of not supported) and still suggest kvmalloc() if
>possible.
>
Reasonable.
As mentioned in [1], kvmalloc() maybe not suitable for some cases, I would
suggest below change.
* Allocating pages from the buddy with __GFP_NOFAIL and order > 1 is
* discouraged. Please consider using kvmalloc() instead if possible.
Or, you prefer only s/supported/discouraged/ ?
[1]: https://lore.kernel.org/all/aQTHMI3t5mNXp0M1@casper.infradead.org
>> */
>> #define __GFP_IO ((__force gfp_t)___GFP_IO)
>> #define __GFP_FS ((__force gfp_t)___GFP_FS)
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index ab385bc252cc..146f7e0a9462 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -4804,7 +4804,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
>>
>> if (unlikely(nofail)) {
>> /*
>> - * Also we don't support __GFP_NOFAIL without __GFP_DIRECT_RECLAIM,
>> + * We don't support __GFP_NOFAIL without __GFP_DIRECT_RECLAIM,
>> * otherwise, we may result in lockup.
>> */
>> WARN_ON_ONCE(!can_direct_reclaim);
--
Wei Yang
Help you, Help me
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: remove out-dated document of __GFP_NOFAIL
2026-08-27 7:49 ` Wei Yang
@ 2026-08-27 8:03 ` Vlastimil Babka (SUSE)
2026-08-27 8:09 ` Wei Yang
0 siblings, 1 reply; 5+ messages in thread
From: Vlastimil Babka (SUSE) @ 2026-08-27 8:03 UTC (permalink / raw)
To: Wei Yang
Cc: akpm, david, ljs, liam, rppt, surenb, mhocko, brendan.jackman,
hannes, ziy, linux-mm, linux-kernel, Baokun Li
On 8/27/26 9:49 AM, Wei Yang wrote:
> On Thu, Aug 27, 2026 at 09:35:26AM +0200, Vlastimil Babka (SUSE) wrote:
>> On 8/27/26 5:05 AM, Wei Yang wrote:
>>> Commit ee040cbd6e48 ("mm/page_alloc: don't warn about large allocations
>>> with __GFP_NOFAIL") remove a warning on allocating large folio with
>>> __GFP_NOFAIL, which is adjusted by commit 903edea6c53f ("mm: warn about
>>> illegal __GFP_NOFAIL usage in a more appropriate location and manner").
>>
>> "which is adjusted by commit" sounds as 903edea6c53f came later than
>> ee040cbd6e48, but it's the opposite. Maybe say "which was placed there"?
>>
>
> Got it.
>
>>> While in that commit, it also documented this behavior which is
>>> out-dated now.
>>>
>>> Adjust the document to align to current code, and adjust the comment
>>> while at it.
>>>
>>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>>> Cc: Baokun Li <libaokun1@huawei.com>
>>> ---
>>> include/linux/gfp_types.h | 2 --
>>> mm/page_alloc.c | 2 +-
>>> 2 files changed, 1 insertion(+), 3 deletions(-)
>>>
>>> diff --git a/include/linux/gfp_types.h b/include/linux/gfp_types.h
>>> index 190191411009..24fde8eb73df 100644
>>> --- a/include/linux/gfp_types.h
>>> +++ b/include/linux/gfp_types.h
>>> @@ -243,8 +243,6 @@ enum {
>>> * used only when there is no reasonable failure policy) but it is
>>> * definitely preferable to use the flag rather than opencode endless
>>> * loop around allocator.
>>> - * Allocating pages from the buddy with __GFP_NOFAIL and order > 1 is
>>> - * not supported. Please consider using kvmalloc() instead.
>>
>> I'm not sure if we want to simply remove the lines, or rather say it's
>> discouraged (instead of not supported) and still suggest kvmalloc() if
>> possible.
>>
>
> Reasonable.
>
> As mentioned in [1], kvmalloc() maybe not suitable for some cases, I would
> suggest below change.
>
> * Allocating pages from the buddy with __GFP_NOFAIL and order > 1 is
> * discouraged. Please consider using kvmalloc() instead if possible.
Yeah that's great! Thanks.
> Or, you prefer only s/supported/discouraged/ ?
>
> [1]: https://lore.kernel.org/all/aQTHMI3t5mNXp0M1@casper.infradead.org
>
>>> */
>>> #define __GFP_IO ((__force gfp_t)___GFP_IO)
>>> #define __GFP_FS ((__force gfp_t)___GFP_FS)
>>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>>> index ab385bc252cc..146f7e0a9462 100644
>>> --- a/mm/page_alloc.c
>>> +++ b/mm/page_alloc.c
>>> @@ -4804,7 +4804,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
>>>
>>> if (unlikely(nofail)) {
>>> /*
>>> - * Also we don't support __GFP_NOFAIL without __GFP_DIRECT_RECLAIM,
>>> + * We don't support __GFP_NOFAIL without __GFP_DIRECT_RECLAIM,
>>> * otherwise, we may result in lockup.
>>> */
>>> WARN_ON_ONCE(!can_direct_reclaim);
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: remove out-dated document of __GFP_NOFAIL
2026-08-27 8:03 ` Vlastimil Babka (SUSE)
@ 2026-08-27 8:09 ` Wei Yang
0 siblings, 0 replies; 5+ messages in thread
From: Wei Yang @ 2026-08-27 8:09 UTC (permalink / raw)
To: Vlastimil Babka (SUSE)
Cc: Wei Yang, akpm, david, ljs, liam, rppt, surenb, mhocko,
brendan.jackman, hannes, ziy, linux-mm, linux-kernel
On Thu, Aug 27, 2026 at 10:03:41AM +0200, Vlastimil Babka (SUSE) wrote:
>On 8/27/26 9:49 AM, Wei Yang wrote:
>> On Thu, Aug 27, 2026 at 09:35:26AM +0200, Vlastimil Babka (SUSE) wrote:
>>> On 8/27/26 5:05 AM, Wei Yang wrote:
>>>> Commit ee040cbd6e48 ("mm/page_alloc: don't warn about large allocations
>>>> with __GFP_NOFAIL") remove a warning on allocating large folio with
>>>> __GFP_NOFAIL, which is adjusted by commit 903edea6c53f ("mm: warn about
>>>> illegal __GFP_NOFAIL usage in a more appropriate location and manner").
>>>
>>> "which is adjusted by commit" sounds as 903edea6c53f came later than
>>> ee040cbd6e48, but it's the opposite. Maybe say "which was placed there"?
>>>
>>
>> Got it.
>>
>>>> While in that commit, it also documented this behavior which is
>>>> out-dated now.
>>>>
>>>> Adjust the document to align to current code, and adjust the comment
>>>> while at it.
>>>>
>>>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>>>> Cc: Baokun Li <libaokun1@huawei.com>
>>>> ---
>>>> include/linux/gfp_types.h | 2 --
>>>> mm/page_alloc.c | 2 +-
>>>> 2 files changed, 1 insertion(+), 3 deletions(-)
>>>>
>>>> diff --git a/include/linux/gfp_types.h b/include/linux/gfp_types.h
>>>> index 190191411009..24fde8eb73df 100644
>>>> --- a/include/linux/gfp_types.h
>>>> +++ b/include/linux/gfp_types.h
>>>> @@ -243,8 +243,6 @@ enum {
>>>> * used only when there is no reasonable failure policy) but it is
>>>> * definitely preferable to use the flag rather than opencode endless
>>>> * loop around allocator.
>>>> - * Allocating pages from the buddy with __GFP_NOFAIL and order > 1 is
>>>> - * not supported. Please consider using kvmalloc() instead.
>>>
>>> I'm not sure if we want to simply remove the lines, or rather say it's
>>> discouraged (instead of not supported) and still suggest kvmalloc() if
>>> possible.
>>>
>>
>> Reasonable.
>>
>> As mentioned in [1], kvmalloc() maybe not suitable for some cases, I would
>> suggest below change.
>>
>> * Allocating pages from the buddy with __GFP_NOFAIL and order > 1 is
>> * discouraged. Please consider using kvmalloc() instead if possible.
>
>Yeah that's great! Thanks.
>
Thanks, I will wait a while for other comment before sending v2.
>> Or, you prefer only s/supported/discouraged/ ?
>>
>> [1]: https://lore.kernel.org/all/aQTHMI3t5mNXp0M1@casper.infradead.org
>>
>>>> */
>>>> #define __GFP_IO ((__force gfp_t)___GFP_IO)
>>>> #define __GFP_FS ((__force gfp_t)___GFP_FS)
>>>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>>>> index ab385bc252cc..146f7e0a9462 100644
>>>> --- a/mm/page_alloc.c
>>>> +++ b/mm/page_alloc.c
>>>> @@ -4804,7 +4804,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
>>>>
>>>> if (unlikely(nofail)) {
>>>> /*
>>>> - * Also we don't support __GFP_NOFAIL without __GFP_DIRECT_RECLAIM,
>>>> + * We don't support __GFP_NOFAIL without __GFP_DIRECT_RECLAIM,
>>>> * otherwise, we may result in lockup.
>>>> */
>>>> WARN_ON_ONCE(!can_direct_reclaim);
>>
--
Wei Yang
Help you, Help me
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-27 8:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-27 3:05 [PATCH] mm: remove out-dated document of __GFP_NOFAIL Wei Yang
2026-08-27 7:35 ` Vlastimil Babka (SUSE)
2026-08-27 7:49 ` Wei Yang
2026-08-27 8:03 ` Vlastimil Babka (SUSE)
2026-08-27 8:09 ` Wei Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox