From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 13D4F10F2 for ; Wed, 29 Apr 2026 01:35:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777426518; cv=none; b=kyhBizvuR9jVlh5NDWK01tbXip5Ue2SB/s4Dkb3b4egroVGuA89wkXQ5dmW64DglsCdzoUIgFV6a4ANM5shS8BsQeYSJvaFuBL2O/pxrSlqmHKXCuv2arLjkCWJ8MXz/apdHxzF6uvullO4zive9cVWXbM8v+ufIoBKc0UxGSZE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777426518; c=relaxed/simple; bh=zsz09Fh4ZkNYvNa/EM9uqYuuGn5g3d5yHSgaE+HAkvc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rHBGrV1EwGqucU5sE+Vf2GaQDlcgKioEhvNMxnD0Y08ojfa8TYCViox8b33KoeDKM51V6t8HlfyIirKdzLrzXQQIafX6NQ0GEL//uu8An8iibYbcv6SninDTJcYeM8viZz1/FWRVOw+rxpSd3h13nXNT1AMMo7EB0SVsV7pm+10= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ehiW3hcK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ehiW3hcK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 365A4C2BCB7; Wed, 29 Apr 2026 01:35:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777426517; bh=zsz09Fh4ZkNYvNa/EM9uqYuuGn5g3d5yHSgaE+HAkvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ehiW3hcK5usEjwMir539AUX6Ta8F9pPK4R5M2qPBBUKPcfTkXpSx8Ydo+DmZ3hVKF aL8W68NDTvx0Tzleh5WTNoMEQcRg7iDNm3hi5W1aRBjP1dAJA4IXGzIFWWk2m2Ug+3 ORZH+CSE4ujGfTnglWseL4BYrtij933eKGtyrgKFn6+pJ2iF6FNrNGjp6s6ssAJMT/ 3BGNqmmZi1GRkrZez393niOPxbbo1IJCQ03qXRBDVdOSWNdHvNvi98cC9RFjZmdGJJ JvDfLvVhQ4LJy9m2EUtUJPtNBgoy3kLAxVHKwcPtlY00r8aDnmS4lbPMUSMyhKsa1g dQT98eXYqp6+A== From: SeongJae Park To: Zhen Ni Cc: SeongJae Park , akpm@linux-foundation.org, vbabka@kernel.org, surenb@google.com, mhocko@suse.com, jackmanb@google.com, hannes@cmpxchg.org, ziy@nvidia.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 4/4] mm/page_owner: document page_owner filter features Date: Tue, 28 Apr 2026 18:35:13 -0700 Message-ID: <20260429013514.88985-1-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260428071112.1420380-5-zhen.ni@easystack.cn> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Tue, 28 Apr 2026 15:11:12 +0800 Zhen Ni wrote: > Add documentation for the page_owner filter functionality, including: > - Print mode filter (full stack vs stack handle) > - NUMA node filter (single node, multiple nodes, ranges) > - Usage examples for both filters > > Signed-off-by: Zhen Ni > --- > > Changes in v3: > - New patch to document filter features as requested by Andrew Morton > --- > Documentation/mm/page_owner.rst | 55 ++++++++++++++++++++++++++++++++- > 1 file changed, 54 insertions(+), 1 deletion(-) > > diff --git a/Documentation/mm/page_owner.rst b/Documentation/mm/page_owner.rst > index 6b12f3b007ec..6261366d33fe 100644 > --- a/Documentation/mm/page_owner.rst > +++ b/Documentation/mm/page_owner.rst > @@ -74,7 +74,17 @@ Usage > > 3) Do the job that you want to debug. > > -4) Analyze information from page owner:: > +4) (Optional) Use filters to focus on specific memory allocations:: > + > + cd /sys/kernel/debug/page_owner_filter > + > + # Print only stack handles instead of full traces > + echo 1 > print_mode > + > + # Filter by NUMA nodes > + echo "0,2-3" > nid Nit. Other parts of the document uses tab for the indentation, while the above new snippet is using four spaces. How about using tab for the consistency? > + > +5) Analyze information from page owner:: > > cat /sys/kernel/debug/page_owner_stacks/show_stacks > stacks.txt > cat stacks.txt > @@ -238,6 +248,49 @@ Usage > ./page_owner_sort --tgid=1,2,3 > ./page_owner_sort --name name1,name2 > > +Page Owner Filters > +================== > + > +The page_owner feature provides filtering capabilities to focus on specific > +memory allocations (e.g., by NUMA node). Filters are controlled through debugfs > +files in ``/sys/kernel/debug/page_owner_filter/``. > + > +Print Mode Filter > +----------------- > + > +The ``print_mode`` file controls the level of detail in stack trace output. > + > +Available modes: > + > +- ``0`` (default): Print full stack traces > +- ``1``: Print only stack handles > + > +The ``print_mode=1`` output format:: > + > + Page allocated via order 0, mask 0x42800(GFP_NOWAIT|__GFP_COMP), > + pid 1, tgid 1 (systemd), ts 349667370 ns > + PFN 0xa00a2 type Unmovable Block 1280 type Unmovable > + Flags 0x33fffe0000004124(...) > + handle: 17432583 Tab for indentation? > + > +To retrieve the full stack trace for a handle, use:: > + > + cat /sys/kernel/debug/page_owner_stacks/show_stacks_handles Tab? > + > +NUMA Node Filter > +---------------- > + > +The ``nid`` file filters pages by NUMA node. This is useful for NUMA-aware > +environments to analyze node-specific memory allocation. > + > +Supported input formats: > + > +- Single node: ``echo "2" > nid`` > +- Multiple nodes: ``echo "0,2,3" > nid`` > +- Node range: ``echo "0-3" > nid`` > +- Mixed format: ``echo "0,2-4,7" > nid`` > +- Disable filter: ``echo "-1" > nid`` > + > STANDARD FORMAT SPECIFIERS > ========================== > :: > -- > 2.20.1 Thanks, SJ