Re: [PATCH v3 4/4] mm/page_alloc: remove a couple of VM_BUG_ON()st
From: Brendan Jackman
Date: Wed Jul 15 2026 - 09:49:41 EST
On Wed Jul 15, 2026 at 1:25 PM UTC, Vlastimil Babka (SUSE) wrote:
> Subject has stray 't' at the end?
Thanks - will fix if we do a v3 (otherwise Andrew, please can you amend
when you apply it?)
> On 7/15/26 13:03, Brendan Jackman wrote:
>> VM_BUG_ON() is out of favour and on the way to removal, since I recently
>> touched alloc_pages_node_noprof() I am removing that invocation, and
>> also removing the __folio_alloc_node_noprof() one for consistency. If
>> this precondition is violated, the system will soon crash anyway.
>>
>> Suggested-by: Zi Yan <ziy@xxxxxxxxxx>
>> Link: https://lore.kernel.org/all/7F866265-3F2E-4765-B9D4-9AB898A9C4AC@xxxxxxxxxx/
>> Acked-by: Zi Yan <ziy@xxxxxxxxxx>
>> Signed-off-by: Brendan Jackman <jackmanb@xxxxxxxxxx>
>
> Reviewed-by: Vlastimil Babka (SUSE) <vbabka@xxxxxxxxxx>
>
>> ---
>> include/linux/gfp.h | 1 -
>> mm/page_alloc.c | 1 -
>> 2 files changed, 2 deletions(-)
>>
>> diff --git a/include/linux/gfp.h b/include/linux/gfp.h
>> index 4d57e9c0bf204..872bc53f32ec8 100644
>> --- a/include/linux/gfp.h
>> +++ b/include/linux/gfp.h
>> @@ -255,7 +255,6 @@ static inline void warn_if_node_offline(int this_node, gfp_t gfp_mask)
>> static inline
>> struct folio *__folio_alloc_node_noprof(gfp_t gfp, unsigned int order, int nid)
>> {
>> - VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES);
>> warn_if_node_offline(nid, gfp);
>>
>> return __folio_alloc_noprof(gfp, order, nid, NULL);
>
> Well if you want more cleanups, I can see in iommu_alloc_pages_node_sz():
>
>
> /*
> * __folio_alloc_node() does not handle NUMA_NO_NODE like
> * alloc_pages_node() did.
> */
> if (nid == NUMA_NO_NODE)
> nid = numa_mem_id();
>
> folio = __folio_alloc_node(gfp | __GFP_ZERO, order, nid);
>
> Should we introduce folio_alloc_node() and make __folio_alloc_node()
> mm-internal, for consistency?
Ha, I literally just wrote that patch. I'm planning to do it as yet
another series as there's a little dance needed to get it all into
shape. But, also happy to just expand this one if you prefer.
Then I'm gonna add alloc_flags to the __ variant so filemap.c can set
ALLOC_UNMAPPED for AS_NO_DIRECT_MAP.