Re: [PATCH v11 2/4] mm/page_owner: add NUMA node filter

From: Zi Yan

Date: Thu Jun 25 2026 - 15:28:13 EST


On Thu Jun 25, 2026 at 12:30 AM EDT, Zhen Ni wrote:
> Add NUMA node filtering functionality to page_owner to allow filtering
> pages by specific NUMA node(s). This is useful for NUMA-aware memory
> allocation analysis and debugging.
>
> The filter supports flexible input formats:
> - Single node: nid=0
> - Multiple nodes: nid=0,2,3
> - Node range: nid=0-3
> - Mixed format: nid=0,2-4,7
>
> Example usage:
> # Using the page_owner_filter tool (recommended)
> ./page_owner_filter -n 0-3
> ./page_owner_filter -m stack_handle -n 0,2-4,7
>
> The implementation uses per-file-descriptor filter state stored in
> file->private_data, allowing each opener to have independent filter
> configuration. It uses nodemask_t for efficient multi-node filtering and
> nodelist_parse() for flexible input parsing. Node validity is verified
> using nodes_subset() to reject nodes without memory.
>
> Signed-off-by: Zhen Ni <zhen.ni@xxxxxxxxxxxx>
> ---

<snip>
>
> /*
> * Maximum input length for filter commands:
> - * 32: print_mode command max length is 17 ("mode=stack_handle").
> + * - 32: print_mode command max length is 17 ("mode=stack_handle")
> + * with sufficient buffer
> + * - 6 * MAX_NUMNODES: worst case for nid list
> + * Worst case per node: ",NNNNN" (comma + 5-digit node number) = 6 bytes
> */
> - max_input_len = 32;
> + max_input_len = 32 + 6 * MAX_NUMNODES;
>
> if (count > max_input_len)
> return -EINVAL;

Hi Andrew,

This needs to be fixed as well.

--
Best Regards,
Yan, Zi