Re: [PATCH] mm/mempolicy: Fix weighted interleave auto sysfs name

From: Rakie Kim

Date: Wed Apr 08 2026 - 00:56:41 EST


On Tue, 7 Apr 2026 07:14:14 -0700 Joshua Hahn <joshua.hahnjy@xxxxxxxxx> wrote:
> The __ATTR macro is a utility that makes defining kobj_attributes easier
> by stringfying the name, verifying the mode, and setting the show/store
> fields in a single initializer. It takes a raw token as the first value,
> rather than a string, so that __ATTR family macros like __ATTR_RW can
> token-paste it for inferring the _show / _store function names.
>
> Commit e341f9c3c841 ("mm/mempolicy: Weighted Interleave Auto-tuning")
> used the __ATTR macro to define the "auto" sysfs for weighted
> interleave. A few months later, commit 2fb6915fa22d ("compiler_types.h:
> add "auto" as a macro for "__auto_type"") introduced a #define macro
> which expanded auto into __auto_type.
>
> This led to the "auto" token passed into __ATTR to be expanded out into
> __auto_type, and the sysfs entry to be displayed as __auto_type as well.
>
> Expand out the __ATTR macro and directly pass a string "auto" instead of
> the raw token 'auto' to prevent it from being expanded out. Also bypass
> the VERIFY_OCTAL_PERMISSIONS check by triple checking that 0664 is
> indeed the intended permissions for this sysfs file.
>
> Before:
> $ ls /sys/kernel/mm/mempolicy/weighted_interleave
> __auto_type node0
>
> After:
> $ ls /sys/kernel/mm/mempolicy/weighted_interleave/
> auto node0

Hello Joshua,

This was indeed an unfortunate and tricky issue to track down, given
that it was caused by an unexpected global macro expansion. great catch,
and thanks for the quick response and clean fix.

Reviewed-by: Rakie Kim <rakie.kim@xxxxxx>