From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-m49233.qiye.163.com (mail-m49233.qiye.163.com [45.254.49.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 098A719D093 for ; Tue, 28 Apr 2026 07:02:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.254.49.233 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777359753; cv=none; b=KYzlLDfxALIRnDvjO2VXuX6ljtdl6CIO4EGu3tKz8BW7U5/h47LkA9fxzRl2j9te8R6Gm1xpxezkmU3aX4lt3p+kyNhoKdhhWDmhVpgmWIm+nQWiDAomHyBuQmzN+tBSJHjeqvOirRQkUiSSQ2ryz1bwAHwaJMGZPCzcDIyzd0E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777359753; c=relaxed/simple; bh=GMimWkbpslc7i/ZVBirzRwetCVmRo7sFBfJsmU2wl0I=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=mrzdcPz/ZrxTqssuwLJwQ8CBL7cPz9Y9goeb4LJoZ2ZW5z2foYPpPCLnUOq/aypnraICjuf/QGFHNp1vzSnPukkJLLFlgbzJ9SiRoYAUP69hH/+JrMh1+hi0QVtmNzXkbiaYOQVWvSKJIOOknnCxUnqj4pawEWXDa2W87KNqg3M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=easystack.cn; spf=pass smtp.mailfrom=easystack.cn; arc=none smtp.client-ip=45.254.49.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=easystack.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=easystack.cn Received: from [192.168.0.18] (unknown [218.94.118.90]) by smtp.qiye.163.com (Hmail) with ESMTP id 19787b34a; Tue, 28 Apr 2026 11:33:02 +0800 (GMT+08:00) Message-ID: <7944d24f-f29a-43b3-918b-ce25e7bae520@easystack.cn> Date: Tue, 28 Apr 2026 11:33:02 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/3] mm/page_owner: add filter infrastructure To: Zi Yan 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 References: <20260419155540.376847-1-zhen.ni@easystack.cn> <20260419155540.376847-2-zhen.ni@easystack.cn> <12259EA6-2095-4F79-A7C4-E89DAFE9E8D6@nvidia.com> From: "zhen.ni" In-Reply-To: <12259EA6-2095-4F79-A7C4-E89DAFE9E8D6@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-HM-Tid: 0a9dd225c0b30229kunmff442fff147b25 X-HM-MType: 1 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFJQjdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVkZSBofVhofGR8dGRkaSRpLSFYVFA kWGhdVGRETFhoSFyQUDg9ZV1kYEgtZQVlJSkNVQk9VSkpDVUJLWVdZFhoPEhUdFFlBWU9LSFVKS0 lPT09IVUpLS1VKQktLWQY+ 在 2026/4/27 23:35, Zi Yan 写道: > On 19 Apr 2026, at 11:55, Zhen Ni wrote: > >> Add data structure for page_owner filtering functionality and create >> debugfs directory for filter controls. >> >> This adds: >> - enum page_owner_print_mode with values for full_stack and stack_handle >> - struct page_owner_filter with print_mode and nid_mask fields >> - Static owner_filter instance initialized with default values >> - page_owner_filter debugfs directory >> >> The filter infrastructure will be used to add print_mode and NUMA node >> filtering capabilities in subsequent commits. >> >> Link: https://lore.kernel.org/linux-mm/20260417154638.22370-2-zhen.ni@easystack.cn/ >> Suggested-by: Zi Yan >> Signed-off-by: Zhen Ni >> --- >> >> Changes in v2: >> - Use enum page_owner_print_mode instead of bool 'compact' for better clarity >> - Use nodemask_t instead of int 'nid' to support multi-node filtering >> --- >> mm/page_owner.c | 20 +++++++++++++++++++- >> 1 file changed, 19 insertions(+), 1 deletion(-) > > The patch can be folded into Patch 2. Otherwise, these new types are not > used and page_owner_filter folder is just empty. > Thanks for your review and suggestion. I kept the 3-patch structure mainly for clear functional separation, which also makes review easier. Patch 1 adds the infrastructure, patch 2 adds print_mode filter, and patch 3 adds NUMA filter. I discussed this with Andrew and he has already accepted the current 3-patch structure into mm-new for testing. Since he's okay with it and mentioned that bisection holes are acceptable in this case, I'll keep the current structure in v3. >> >> diff --git a/mm/page_owner.c b/mm/page_owner.c >> index 8178e0be557f..5884d883837e 100644 >> --- a/mm/page_owner.c >> +++ b/mm/page_owner.c >> @@ -54,6 +54,21 @@ struct stack_print_ctx { >> u8 flags; >> }; >> >> +enum page_owner_print_mode { >> + PAGE_OWNER_PRINT_FULL_STACK, >> + PAGE_OWNER_PRINT_STACK_HANDLE, >> +}; >> + >> +struct page_owner_filter { >> + enum page_owner_print_mode print_mode; >> + nodemask_t nid_mask; >> +}; >> + >> +static struct page_owner_filter owner_filter = { >> + .print_mode = PAGE_OWNER_PRINT_FULL_STACK, >> + .nid_mask = NODE_MASK_NONE, >> +}; >> + >> static bool page_owner_enabled __initdata; >> DEFINE_STATIC_KEY_FALSE(page_owner_inited); >> >> @@ -973,7 +988,7 @@ DEFINE_SIMPLE_ATTRIBUTE(page_owner_threshold_fops, &page_owner_threshold_get, >> >> static int __init pageowner_init(void) >> { >> - struct dentry *dir; >> + struct dentry *dir, *filter_dir; >> >> if (!static_branch_unlikely(&page_owner_inited)) { >> pr_info("page_owner is disabled\n"); >> @@ -981,6 +996,9 @@ 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); >> + >> dir = debugfs_create_dir("page_owner_stacks", NULL); >> debugfs_create_file("show_stacks", 0400, dir, >> (void *)(STACK_PRINT_FLAG_STACK | >> -- >> 2.20.1 > > > Best Regards, > Yan, Zi > > Best regards, Zhen