diff options
| author | Zenghui Yu (Huawei) <zenghui.yu@linux.dev> | 2026-10-22 20:27:52 +0800 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-11-02 18:14:41 -0800 |
| commit | b6732c6d43139ea56de8bc62e87ace8543ef784f (patch) | |
| tree | 0c818364b9b0a28be9d26eb4f7cf53dfbbf493ea /include/linux/timerqueue.h | |
| parent | 92daa8652f88c8cfc05f4899a8408a04b02f211e (diff) | |
mm/page_alloc: mark pages freed by __free_pages_core() as not tagged
Onlining hotplugged memory (e.g., a dev_dax device bound to kmem) with
CONFIG_MEM_ALLOC_PROFILING_DEBUG triggers:
alloc_tag was not set
WARNING: ./include/linux/alloc_tag.h:166 at __pgalloc_tag_sub+0x1fc/0x254
Call trace:
__pgalloc_tag_sub+0x1fc/0x254 (P)
__free_pages_ok+0x14c/0x6ac
__free_pages_core+0xa8/0x188
generic_online_page+0x14/0x20
online_pages+0x220/0x3b0
memory_subsys_online+0xfc/0x198
device_online+0x58/0xe0
state_store+0xf0/0xf8
Pages entering the buddy through __free_pages_core() have never been
allocated, so their allocation tag references are NULL. The free path,
__free_pages_prepare() -> pgalloc_tag_sub(), expects a valid tag or a
CODETAG_EMPTY mark and warns otherwise. Paths feeding never-allocated
pages into the buddy are therefore expected to mark them with
clear_page_tag_ref() first, like init_cma_reserved_pageblock() and
free_reserved_pages() do; of __free_pages_core()'s callers only
memblock_free_pages() clears the tag ref itself, and the hotplug
onlining path was missed.
Since all __free_pages_core() callers free never-allocated pages, mark the
head page as not tagged in __free_pages_core() itself instead of relying on
each caller, and drop the now-redundant clearing from
memblock_free_pages().
Link: https://lore.kernel.org/20261022122752.74774-1-zenghui.yu@linux.dev
Fixes: dcfe378c81f7 ("lib: introduce support for page allocation tagging")
Signed-off-by: Zenghui Yu (Huawei) <zenghui.yu@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Brendan Jackman <brendan.jackman@linux.dev>
Cc: Zi Yan <ziy@nvidia.com>
Cc: <stable@vger.kernel.org>
Diffstat (limited to 'include/linux/timerqueue.h')
0 files changed, 0 insertions, 0 deletions
