Re: [PATCH v2 3/6] mm/page_owner: hoist CONFIG_MEMCG to function level for print_page_owner_memcg()

From: Zi Yan

Date: Fri Jun 26 2026 - 14:52:42 EST


On Thu Jun 25, 2026 at 10:45 PM EDT, Ye Liu wrote:
> The print_page_owner_memcg() function has CONFIG_MEMCG guarding its
> entire body via #ifdef inside the function, which leaves a no-op

no-op might not be accurate, since the purpose is not to change
scnprintf() return values from prior invocations. Maybe just remove
"no-op" in the commit message to avoid confusion.

> { return ret; } when the config is disabled. Hoist the #ifdef to the
> top level so the real implementation and the empty stub are two clearly
> separated definitions.
>
> No functional change.
>
> Signed-off-by: Ye Liu <ye.liu@xxxxxxxxx>
> ---
> mm/page_owner.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>

<snip>

> +#else
> +static inline int print_page_owner_memcg(char *kbuf, size_t count, int ret,
> + struct page *page)
> +{
> + return ret;

It is not obvious why we need to return ret here, until I find that ret
cumulates scnprintf() return values.

> +}
> +#endif
>
> static ssize_t
> print_page_owner(char __user *buf, size_t count, unsigned long pfn,

LGTM.

Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>


--
Best Regards,
Yan, Zi