Re: [PATCH v3 15/16] mm: replace __GFP_NO_CODETAG with ALLOC_NO_CODETAG
From: Brendan Jackman
Date: Tue Jun 30 2026 - 08:09:03 EST
On Tue Jun 30, 2026 at 1:55 AM UTC, Hao Ge wrote:
>> +/*
>> + * Skip early PFN recording for a page allocation. Used by
>> + * __alloc_tag_add_early_pfn() to avoid recursion when allocating pages for the
>> + * early PFN tracking list itself.
>> + *
>> + * Codetags of the pages allocated with __GFP_NO_CODETAG should be
>> + * cleared (via clear_page_tag_ref()) before freeing the pages to prevent
>> + * alloc_tag_sub_check() from triggering a warning.
>> + */
>
>
> I originally wrote this lengthy comment because the logic lives inside
> alloc_tag.c.
>
> I wanted to document all the context to avoid confusion when revisiting
> this code later on.
>
> We've since replaced __GFP_NO_CODETAG with ALLOC_NO_CODETAG, a generic
> alloc_flags bit defined in page_alloc.h.
>
> The original long comment is no longer accurate:
>
> Given that, I suggest updating it to the following:
>
> /*
>
> * Avoid alloc_tag recursion for internal allocations.
>
> * Callers must clear_page_tag_ref() before
> * freeing to avoid warnings from alloc_tag_sub_check().
>
> */
Thanks for the context, pasting this in for v4!