Re: [7.0-rc1] codetag: kernel warning "alloc_tag was not set" during boot
From: David Wang
Date: Tue Feb 24 2026 - 06:18:49 EST
At 2026-02-24 15:07:08, "Suren Baghdasaryan" <surenb@xxxxxxxxxx> wrote:
>On Mon, Feb 23, 2026 at 6:28 PM David Wang <00107082@xxxxxxx> wrote:
>>
>>
>> At 2026-02-24 01:18:32, "Vlastimil Babka" <vbabka@xxxxxxxx> wrote:
>> >On 2/23/26 16:51, David Wang wrote:
>> >> Hi,
>> >>
>> >> When upgrade to 7.0.0-rc1, caught a kernel WARN during boot:
>> >
>> >Would this possibly help? (it probably shouldn't but let's see)
>> >https://lore.kernel.org/all/20260223075809.19265-1-harry.yoo@xxxxxxxxxx/
>> >
>>
>> Hi,
>> I tried this patch, but sadly, it doesn't help with the warning on my system...
>
>Unfortunately I can't boot far enough with your config to get that warning.
>
>You might be able to track down which allocation does not get its tag
>by first checking for current->alloc_tag==NULL inside
>__alloc_tagging_slab_alloc_hook() and dump the stack if that happens.
>If there are no hits (which is probably what will happen) you can do
>the same while checking for obj_exts==NULL. I suspect that condition
>will hit multiple times and one of those will likely be the cause of
>this warning. I'll look into this more tomorrow if the cause is not
>found by then.
I throw in some debug code :
iff --git a/mm/slub.c b/mm/slub.c
index 862642c165ed..2f72fbae4ecc 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2375,6 +2375,14 @@ __alloc_tagging_slab_alloc_hook(struct kmem_cache *s, void *object, gfp_t flags)
* check should be added before alloc_tag_add().
*/
if (obj_exts) {
+ if (!current->alloc_tag) {
+ static int counter=0;
+ if (counter==0) {
+ pr_warn("object_exts & !current->alloc_tag");
+ dump_stack();
+ }
+ counter++;
+ }
unsigned int obj_idx = obj_to_index(s, slab, object);
get_slab_obj_exts(obj_exts);
@@ -2382,6 +2390,14 @@ __alloc_tagging_slab_alloc_hook(struct kmem_cache *s, void *object, gfp_t flags)
alloc_tag_add(&obj_ext->ref, current->alloc_tag, s->size);
put_slab_obj_exts(obj_exts);
} else {
+ if (!current->alloc_tag) {
+ static int counter=0;
+ if (counter==0) {
+ pr_warn("!object_exts & !current->alloc_tag");
+ dump_stack();
+ }
+ counter++;
+ }
alloc_tag_set_inaccurate(current->alloc_tag);
}
}
But neither "object_exts & !current->alloc_tag" nor "!object_exts & !current->alloc_tag" was ever hit.
Some update:
1. Same warning shows up with my KVM on the same host.
2. reverting 913ffd3a1bf5 can make the warning go away.
David
>
>>
>>
>>