Re: [PATCH v3 4/4] mm/page_alloc: remove a couple of VM_BUG_ON()st

"Vlastimil Babka (SUSE)" <[email protected]>
Newsgroups dev.linux.lists.linux-rt-devel,org.kernel.vger.cgroups,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <[email protected]>
Subject has stray 't' at the end?

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 <[email protected]>
> Link: https://lore.kernel.org/all/[email protected]/
> Acked-by: Zi Yan <[email protected]>
> Signed-off-by: Brendan Jackman <[email protected]>

Reviewed-by: Vlastimil Babka (SUSE) <[email protected]>

> ---
>  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?

> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 25a83a57aab66..4c6815f84adc6 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5427,7 +5427,6 @@ struct page *alloc_pages_node_noprof(int nid, gfp_t gfp_mask, unsigned int order
>  	if (nid == NUMA_NO_NODE)
>  		nid = numa_mem_id();
>  
> -	VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES);
>  	warn_if_node_offline(nid, gfp_mask);
>  
>  	return __alloc_pages_noprof(gfp_mask, order, nid, NULL, ALLOC_DEFAULT);
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.