[PATCH v3 3/3] tools/mm/page_owner_sort: show available sort keys in usage text
From: Ye Liu
Date: Tue Aug 18 2026 - 22:17:28 EST
From: Ye Liu <liuye@xxxxxxxxxx>
The --sort option accepts abbreviated or complete key names, but the
usage text never listed them. Users had to read the source or the
documentation to discover valid keys.
List all available keys (full form and abbreviation) with a brief
description and examples directly in the --sort help section.
Signed-off-by: Ye Liu <liuye@xxxxxxxxxx>
Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
---
tools/mm/page_owner_sort.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/mm/page_owner_sort.c b/tools/mm/page_owner_sort.c
index 10a814ba5301..5c1b23c0ed8c 100644
--- a/tools/mm/page_owner_sort.c
+++ b/tools/mm/page_owner_sort.c
@@ -772,6 +772,15 @@ static void usage(void)
"\t\t\targument in the form of a comma-separated list with some\n"
"\t\t\tcommon fields predefined (pid, tgid, comm, stacktrace, allocator, module)\n"
"--sort <order>\t\tSpecify sort order as: [+|-]key[,[+|-]key[,...]]\n"
+ "\t\t\tAvailable keys:\n"
+ "\t\t\t pid(p), tgid(tg), name(n), stacktrace(st),\n"
+ "\t\t\t txt(T), alloc_ts(at), allocator(ator), module(mod)\n"
+ "\t\t\tThe \"+\" is optional since default direction is\n"
+ "\t\t\tincreasing numerical or lexicographic order.\n"
+ "\t\t\tMixed use of abbreviated and complete-form is allowed.\n"
+ "\t\t\tExamples:\n"
+ "\t\t\t --sort=n,+pid,-tgid\n"
+ "\t\t\t --sort=mod,at\n"
);
}
--
2.25.1