* [PATCH 0/3] alloc_tag: two fixes and one cleanup
@ 2026-11-19 8:52 David Hildenbrand (Arm)
2026-11-19 8:52 ` [PATCH 1/3] alloc_tag: handle a NULL tag in alloc_tag_set_inaccurate() David Hildenbrand (Arm)
2026-11-20 10:02 ` [PATCH 0/3] alloc_tag: two fixes and one cleanup Vlastimil Babka (SUSE)
0 siblings, 2 replies; 5+ messages in thread
From: David Hildenbrand (Arm) @ 2026-11-19 8:52 UTC (permalink / raw)
To: Suren Baghdasaryan, Hao Ge, Vlastimil Babka, Johannes Weiner,
Michal Hocko, Brendan Jackman, Zi Yan, Andrew Morton, Usama Arif,
Shakeel Butt, Harry Yoo, Hao Li, Christoph Lameter,
David Rientjes, Roman Gushchin
Cc: linux-mm, David Hildenbrand (Arm), stable, Chris Mason
Hi,
two fixes (one for alloc_tag as triggered by slab, one for mempool) and
one related cleanup to make things consistent.
Quickly reproduced and tested the warnings in a x86-64 VM.
This should go through Andrew's tree. No need to rush, it can wait until
the next merge window.
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
---
Chris Mason (1):
mempool: fix missing alloc tagging in mempool_resize()
David Hildenbrand (Arm) (2):
alloc_tag: handle a NULL tag in alloc_tag_set_inaccurate()
mempool: account the element array to the caller
include/linux/alloc_tag.h | 3 ++-
include/linux/mempool.h | 7 +++----
mm/mempool.c | 23 ++++++++++++-----------
mm/page_alloc.c | 3 +--
4 files changed, 18 insertions(+), 18 deletions(-)
---
base-commit: 4405c18c95d2d0f99f6c581ef0ee8591a1aa6ccd
change-id: 20261119-alloc_tag-57326f1fcc85
Best regards,
--
David Hildenbrand (Arm) <david@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 1/3] alloc_tag: handle a NULL tag in alloc_tag_set_inaccurate()
2026-11-19 8:52 [PATCH 0/3] alloc_tag: two fixes and one cleanup David Hildenbrand (Arm)
@ 2026-11-19 8:52 ` David Hildenbrand (Arm)
2026-11-20 10:02 ` [PATCH 0/3] alloc_tag: two fixes and one cleanup Vlastimil Babka (SUSE)
1 sibling, 0 replies; 5+ messages in thread
From: David Hildenbrand (Arm) @ 2026-11-19 8:52 UTC (permalink / raw)
To: Suren Baghdasaryan, Hao Ge, Vlastimil Babka, Johannes Weiner,
Michal Hocko, Brendan Jackman, Zi Yan, Andrew Morton, Usama Arif,
Shakeel Butt, Harry Yoo, Hao Li, Christoph Lameter,
David Rientjes, Roman Gushchin
Cc: linux-mm, David Hildenbrand (Arm), stable, Chris Mason
With memory allocation profiling enabled after boot, a slab allocation
can dereference a NULL pointer if current->alloc_tag is not set and
allocating the slab object extensions fails:
__alloc_tagging_slab_alloc_hook() passes current->alloc_tag to
alloc_tag_set_inaccurate(), which does not handle a NULL tag currently.
One way to trigger it is through rhashtable: rhashtable_init() records
current->alloc_tag in ht->alloc_tag, which is NULL while profiling is
disabled. Once profiling gets enabled, alloc_hooks_tag() sets
current->alloc_tag to that NULL tag when allocating a bucket table.
Fix it by handling NULL tags in alloc_tag_set_inaccurate(), just
like alloc_tag_add() and alloc_tag_sub() already do, and drop the now
unnecessary check in __pgalloc_tag_add().
This has low urgency.
Fixes: b9e2f58ffb84 ("alloc_tag: mark inaccurate allocation counters in /proc/allocinfo output")
Cc: stable@vger.kernel.org
Reported-by: Chris Mason <mason@kernel.org>
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
---
include/linux/alloc_tag.h | 3 ++-
mm/page_alloc.c | 3 +--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/alloc_tag.h b/include/linux/alloc_tag.h
index 7f2d80a597924..0f9909c6701a7 100644
--- a/include/linux/alloc_tag.h
+++ b/include/linux/alloc_tag.h
@@ -227,7 +227,8 @@ static inline void alloc_tag_sub(union codetag_ref *ref, size_t bytes)
static inline void alloc_tag_set_inaccurate(struct alloc_tag *tag)
{
- tag->ct.flags |= CODETAG_FLAG_INACCURATE;
+ if (tag)
+ tag->ct.flags |= CODETAG_FLAG_INACCURATE;
}
static inline bool alloc_tag_is_inaccurate(struct alloc_tag *tag)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2fef4092c913c..0b76923145456 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1262,8 +1262,7 @@ void __pgalloc_tag_add(struct page *page, struct task_struct *task,
* clear the tag ref later when page_ext is initialized.
*/
alloc_tag_add_early_pfn(page_to_pfn(page), alloc_flags);
- if (task->alloc_tag)
- alloc_tag_set_inaccurate(task->alloc_tag);
+ alloc_tag_set_inaccurate(task->alloc_tag);
}
}
--
2.56.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/3] alloc_tag: two fixes and one cleanup
2026-11-19 8:52 [PATCH 0/3] alloc_tag: two fixes and one cleanup David Hildenbrand (Arm)
2026-11-19 8:52 ` [PATCH 1/3] alloc_tag: handle a NULL tag in alloc_tag_set_inaccurate() David Hildenbrand (Arm)
@ 2026-11-20 10:02 ` Vlastimil Babka (SUSE)
2026-11-20 10:08 ` David Hildenbrand (Arm)
1 sibling, 1 reply; 5+ messages in thread
From: Vlastimil Babka (SUSE) @ 2026-11-20 10:02 UTC (permalink / raw)
To: David Hildenbrand (Arm), Suren Baghdasaryan, Hao Ge,
Johannes Weiner, Michal Hocko, Brendan Jackman, Zi Yan,
Andrew Morton, Usama Arif, Shakeel Butt, Harry Yoo, Hao Li,
Christoph Lameter, David Rientjes, Roman Gushchin
Cc: linux-mm, stable, Chris Mason
On 11/19/26 09:52, David Hildenbrand (Arm) wrote:
> Hi,
>
> two fixes (one for alloc_tag as triggered by slab, one for mempool) and
> one related cleanup to make things consistent.
>
> Quickly reproduced and tested the warnings in a x86-64 VM.
>
> This should go through Andrew's tree. No need to rush, it can wait until
> the next merge window.
mempool is part of slab section and the first fix while in page_alloc.c is
also for slab, so we'll take it :)
>
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
> ---
> Chris Mason (1):
> mempool: fix missing alloc tagging in mempool_resize()
>
> David Hildenbrand (Arm) (2):
> alloc_tag: handle a NULL tag in alloc_tag_set_inaccurate()
> mempool: account the element array to the caller
>
> include/linux/alloc_tag.h | 3 ++-
> include/linux/mempool.h | 7 +++----
> mm/mempool.c | 23 ++++++++++++-----------
> mm/page_alloc.c | 3 +--
> 4 files changed, 18 insertions(+), 18 deletions(-)
> ---
> base-commit: 4405c18c95d2d0f99f6c581ef0ee8591a1aa6ccd
> change-id: 20261119-alloc_tag-57326f1fcc85
>
> Best regards,
> --
> David Hildenbrand (Arm) <david@kernel.org>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] alloc_tag: two fixes and one cleanup
2026-11-20 10:02 ` [PATCH 0/3] alloc_tag: two fixes and one cleanup Vlastimil Babka (SUSE)
@ 2026-11-20 10:08 ` David Hildenbrand (Arm)
2026-11-20 10:40 ` Vlastimil Babka (SUSE)
0 siblings, 1 reply; 5+ messages in thread
From: David Hildenbrand (Arm) @ 2026-11-20 10:08 UTC (permalink / raw)
To: Vlastimil Babka (SUSE), Suren Baghdasaryan, Hao Ge,
Johannes Weiner, Michal Hocko, Brendan Jackman, Zi Yan,
Andrew Morton, Usama Arif, Shakeel Butt, Harry Yoo, Hao Li,
Christoph Lameter, David Rientjes, Roman Gushchin
Cc: linux-mm, stable, Chris Mason
On 11/20/26 11:02, Vlastimil Babka (SUSE) wrote:
> On 11/19/26 09:52, David Hildenbrand (Arm) wrote:
>> Hi,
>>
>> two fixes (one for alloc_tag as triggered by slab, one for mempool) and
>> one related cleanup to make things consistent.
>>
>> Quickly reproduced and tested the warnings in a x86-64 VM.
>>
>> This should go through Andrew's tree. No need to rush, it can wait until
>> the next merge window.
>
> mempool is part of slab section and the first fix while in page_alloc.c is
> also for slab, so we'll take it :)
Thanks! :)
--
Cheers,
David
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] alloc_tag: two fixes and one cleanup
2026-11-20 10:08 ` David Hildenbrand (Arm)
@ 2026-11-20 10:40 ` Vlastimil Babka (SUSE)
0 siblings, 0 replies; 5+ messages in thread
From: Vlastimil Babka (SUSE) @ 2026-11-20 10:40 UTC (permalink / raw)
To: David Hildenbrand (Arm), Suren Baghdasaryan, Hao Ge,
Johannes Weiner, Michal Hocko, Brendan Jackman, Zi Yan,
Andrew Morton, Usama Arif, Shakeel Butt, Harry Yoo, Hao Li,
Christoph Lameter, David Rientjes, Roman Gushchin
Cc: linux-mm, stable, Chris Mason
On 11/20/26 11:08, David Hildenbrand (Arm) wrote:
> On 11/20/26 11:02, Vlastimil Babka (SUSE) wrote:
>> On 11/19/26 09:52, David Hildenbrand (Arm) wrote:
>>> Hi,
>>>
>>> two fixes (one for alloc_tag as triggered by slab, one for mempool) and
>>> one related cleanup to make things consistent.
>>>
>>> Quickly reproduced and tested the warnings in a x86-64 VM.
>>>
>>> This should go through Andrew's tree. No need to rush, it can wait until
>>> the next merge window.
>>
>> mempool is part of slab section and the first fix while in page_alloc.c is
>> also for slab, so we'll take it :)
>
> Thanks! :)
Actually, let's separate to minimize conflict potential
patch 1 merged to: page_alloc/for-7.5/misc
patches 2+3 merged to: slab/for-7.5/misc
Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-20 10:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 8:52 [PATCH 0/3] alloc_tag: two fixes and one cleanup David Hildenbrand (Arm)
2026-11-19 8:52 ` [PATCH 1/3] alloc_tag: handle a NULL tag in alloc_tag_set_inaccurate() David Hildenbrand (Arm)
2026-11-20 10:02 ` [PATCH 0/3] alloc_tag: two fixes and one cleanup Vlastimil Babka (SUSE)
2026-11-20 10:08 ` David Hildenbrand (Arm)
2026-11-20 10:40 ` Vlastimil Babka (SUSE)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox