tools/mm/page_owner_sort: show available sort keys in usage text

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.

Link: https://lore.kernel.org/20260819021611.2910835-4-ye.liu@linux.dev
Signed-off-by: Ye Liu <liuye@kylinos.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Yichong Chen <chenyichong@uniontech.com>
Cc: Liu Jing <liujing@cmss.chinamobile.com>
This commit is contained in:
Ye Liu 2026-08-19 10:16:11 +08:00 committed by Andrew Morton
parent 305a263d89
commit 611aebcec3

View File

@ -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"
);
}