linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: Zhen Ni <zhen.ni@easystack.cn>
Cc: akpm@linux-foundation.org, vbabka@kernel.org, surenb@google.com,
	mhocko@suse.com, jackmanb@google.com, hannes@cmpxchg.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] mm/page_owner: add NUMA node filter
Date: Fri, 17 Apr 2026 11:58:10 -0400	[thread overview]
Message-ID: <EA267977-8282-4A65-8BDB-A6A370B75F7C@nvidia.com> (raw)
In-Reply-To: <20260417154638.22370-4-zhen.ni@easystack.cn>

On 17 Apr 2026, at 11:46, Zhen Ni wrote:

> Add NUMA node filtering functionality to page_owner to allow
> filtering pages by specific NUMA node.

Would a NUMA node bitmask be more generally applicable?
For sysfs, input and output can be a list of NUMA nodes that will be printed.

>
> The filter allows users to focus on pages from a specific NUMA node,
> which is useful for NUMA-aware memory allocation analysis and debugging.
> Setting nid to -1 disables filtering (default behavior).
>
> Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
> ---
>  mm/page_owner.c | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>
> diff --git a/mm/page_owner.c b/mm/page_owner.c
> index 214b58eef3d8..ebc29f3f516d 100644
> --- a/mm/page_owner.c
> +++ b/mm/page_owner.c
> @@ -726,6 +726,13 @@ read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos)
>  		if (unlikely(!page_ext))
>  			continue;
>
> +		if (READ_ONCE(owner_filter.nid) >= 0) {
> +			int nid = page_to_nid(page);
> +
> +			if (nid != READ_ONCE(owner_filter.nid))
> +				goto ext_put_continue;
> +		}
> +
>  		/*
>  		 * Some pages could be missed by concurrent allocation or free,
>  		 * because we don't hold the zone lock.
> @@ -987,6 +994,24 @@ static int page_owner_threshold_set(void *data, u64 val)
>  DEFINE_SIMPLE_ATTRIBUTE(page_owner_threshold_fops, &page_owner_threshold_get,
>  			&page_owner_threshold_set, "%llu");
>
> +static int page_owner_nid_filter_get(void *data, u64 *val)
> +{
> +	*val = READ_ONCE(owner_filter.nid);
> +	return 0;
> +}
> +
> +static int page_owner_nid_filter_set(void *data, u64 val)
> +{
> +	if (val >= MAX_NUMNODES && val != (u64)-1)
> +		return -EINVAL;
> +	WRITE_ONCE(owner_filter.nid, val);
> +	return 0;
> +}
> +
> +DEFINE_SIMPLE_ATTRIBUTE(page_owner_nid_filter_fops,
> +			&page_owner_nid_filter_get,
> +			&page_owner_nid_filter_set, "%lld");
> +
>  static int page_owner_compact_get(void *data, u64 *val)
>  {
>  	*val = READ_ONCE(owner_filter.compact);
> @@ -1018,6 +1043,8 @@ static int __init pageowner_init(void)
>  	debugfs_create_file("page_owner", 0400, NULL, NULL, &page_owner_fops);
>
>  	filter_dir = debugfs_create_dir("page_owner_filter", NULL);
> +	debugfs_create_file("nid", 0600, filter_dir, NULL,
> +			    &page_owner_nid_filter_fops);
>  	debugfs_create_file("compact", 0600, filter_dir, NULL,
>  			    &page_owner_compact_fops);
>
> -- 
> 2.20.1


Best Regards,
Yan, Zi


      reply	other threads:[~2026-04-17 15:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-17 15:46 [PATCH 0/3] mm/page_owner: add filter infrastructure for compact mode and NUMA filtering Zhen Ni
2026-04-17 15:46 ` [PATCH 1/3] mm/page_owner: add filter infrastructure Zhen Ni
2026-04-17 15:46 ` [PATCH 2/3] mm/page_owner: add compact mode filter Zhen Ni
2026-04-17 15:55   ` Zi Yan
2026-04-17 15:46 ` [PATCH 3/3] mm/page_owner: add NUMA node filter Zhen Ni
2026-04-17 15:58   ` Zi Yan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=EA267977-8282-4A65-8BDB-A6A370B75F7C@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=zhen.ni@easystack.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox