From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-m3281.qiye.163.com (mail-m3281.qiye.163.com [220.197.32.81]) (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 3E19630D3ED for ; Mon, 29 Jun 2026 08:47:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.32.81 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782722839; cv=none; b=pORBRAsKElCIXwNXtSkEqYVunFms7m0pVgiCyzNfwd8LQXIFpmcJz39L8fveMgmMWh/maxaIcrzDkG+LCpz0xBwkXwmi6qlDQRAAjG/JEUREG4Z2KbXU/lKRLpcoYdziIclwUba78sPPdQ+w58Pf9pVWioiAMycIt8Sg6r20Uqw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782722839; c=relaxed/simple; bh=EiP3fsYyclKnoP1zRbAmTUfGf8jPJSijPnqPRZtuMgo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=QaXPiPFGqOMVsPBkM7aLgM+b3Z1YYFHc0+0noeTKqajc5fdrcX8iAkx7fnsRt5wjw/hq6RzGt3Ose44xGsBFxh/xjvsZg5jOHyfcsCPDN7rxSbQGHx3N7GFThg4MZ1FWuRApsIlfIB64OoHFTOpiJEg5OlfWgzd2wfWAZO0IRdM= 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=220.197.32.81 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.59] (unknown [218.94.118.90]) by smtp.qiye.163.com (Hmail) with ESMTP id 1c062846a; Mon, 29 Jun 2026 16:31:49 +0800 (GMT+08:00) Message-ID: <8762c792-da23-461a-bd19-5976157c18e5@easystack.cn> Date: Mon, 29 Jun 2026 16:31:48 +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 v11 3/4] tools/mm: add page_owner_filter userspace tool To: Andrew Morton Cc: 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 References: <20260625043101.338794-1-zhen.ni@easystack.cn> <20260625043101.338794-4-zhen.ni@easystack.cn> <20260624215044.1c50c765a240f50fdf49189a@linux-foundation.org> From: "zhen.ni" In-Reply-To: <20260624215044.1c50c765a240f50fdf49189a@linux-foundation.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-HM-Tid: 0a9f128190b90229kunm1c7606521c68d2 X-HM-MType: 1 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFJQjdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVlDHUpOVkpKTk9OHkNCHU1IH1YVFA kWGhdVGRETFhoSFyQUDg9ZV1kYEgtZQVlJSkNVQk9VSkpDVUJLWVdZFhoPEhUdFFlBWU9LSFVKS0 lPT09IVUpLS1VKQktLWQY+ 在 2026/6/25 12:50, Andrew Morton 写道: > On Thu, 25 Jun 2026 12:31:00 +0800 Zhen Ni wrote: > >> Add a userspace filtering tool for page_owner that supports per-fd >> filtering with print_mode and NUMA node filters. > > Could this functionality have been built into page_owner_sort.c, or > does that not make any sense? > > > Hi, I've considered the possibility of merging the two tools. They serve different purposes:  - page_owner_sort: a post-processing tool for sorting/aggregating already-captured page_owner dumps  - page_owner_filter: a real-time filtering tool They function like two stages in a pipeline. While there may be opportunities to share some parsing/formatting code between the two tools in the future, a direct merge doesn't make sense. I believe that as page_owner_filter's functionality expands, it could potentially replace most of page_owner_sort's features. Looking at page_owner_sort's current interface: Usage: ./page_owner_sort [OPTIONS] -a Sort by memory allocation time. -m Sort by total memory. -n Sort by task command name. -p Sort by pid. -P Sort by tgid. -s Sort by the stacktrace. -t Sort by number of times record is seen (default). --pid Select by pid. --tgid Select by tgid. --name Select by command name. --cull Cull by user-defined rules. --sort Specify sort order. For example: - Sorting by task command name (-n), PID (-p), TGID (-P), or stacktrace (-s) seems less useful in practice — users typically care about specific processes rather than sorted lists. - Sorting by total memory (-m) or occurrence count (-t) overlaps with /sys/kernel/debug/page_owner_stacks functionality, which is more efficient. - Filtering options (--pid, --tgid, --name, --cull) could potentially be implemented in page_owner_filter as well. Thanks, Zhen