Re: [PATCH v5 2/5] alloc_tag: Introduce IOCTLs to toggle allocation tracepoints

From: Andrew Morton

Date: Fri Nov 06 2026 - 10:33:44 EST


On Fri, 6 Nov 2026 15:54:33 +0800 Hao Ge <hao.ge@xxxxxxxxx> wrote:

> >
> > -static inline bool alloc_tag_trace_enabled(const struct alloc_tag *tag)
> > +static __always_inline bool alloc_tag_trace_enabled(const struct alloc_tag *tag)
> > {
> > if (static_branch_unlikely(&alloc_tag_trace_key))
> > return tag && alloc_tag_is_traced(tag);
> > _
> >
>
>
> Thanks a lot for looking at this - and for putting together a fix at all.
>
> Perhaps alloc_tag_is_traced needs the same treatment as well?
>
> Even with your patch applied, I still hit the warning, just attributed to a different symbol:
>
> WARNING: modpost: vmlinux: section mismatch in reference:
> alloc_tag_is_traced+0x10 (section: .text.unlikely) -> initcall_level_names (section: .init.data)
>
> Marking both helpers __always_inline clears the warning in my build, and it would fit what the series
> intends for the fast path anyway.

Great, thanks, I added another -fix on top:

--- a/include/linux/alloc_tag.h~alloc_tag-introduce-ioctls-to-toggle-allocation-tracepoints-fix-fix
+++ a/include/linux/alloc_tag.h
@@ -156,7 +156,7 @@ static inline void alloc_tag_clear_trace
atomic_andnot(CODETAG_FLAG_TRACE_ON, &tag->ct.flags);
}

-static inline bool alloc_tag_is_traced(const struct alloc_tag *tag)
+static __always_inline inline bool alloc_tag_is_traced(const struct alloc_tag *tag)
{
return !!(atomic_read(&tag->ct.flags) & CODETAG_FLAG_TRACE_ON);
}
_