Commit 5bf65d4a authored by Ye Liu's avatar Ye Liu Committed by Andrew Morton
Browse files

tools/mm/page_owner_sort: add help option support

Add -h/--help option to display usage information and improve code style.

Link: https://lkml.kernel.org/r/20251016054927.138510-1-ye.liu@linux.dev


Signed-off-by: default avatarYe Liu <liuye@kylinos.cn>
Cc: SeongJae Park <sj@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent d929525c
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -669,12 +669,13 @@ int main(int argc, char **argv)
		{ "name", required_argument, NULL, 3 },
		{ "cull", required_argument, NULL, 4 },
		{ "sort", required_argument, NULL, 5 },
		{ "help", no_argument, NULL, 'h' },
		{ 0, 0, 0, 0},
	};

	compare_flag = COMP_NO_FLAG;

	while ((opt = getopt_long(argc, argv, "admnpstP", longopts, NULL)) != -1)
	while ((opt = getopt_long(argc, argv, "admnpstPh", longopts, NULL)) != -1)
		switch (opt) {
		case 'a':
			compare_flag |= COMP_ALLOC;
@@ -700,6 +701,9 @@ int main(int argc, char **argv)
		case 'n':
			compare_flag |= COMP_COMM;
			break;
		case 'h':
			usage();
			exit(0);
		case 1:
			filter = filter | FILTER_PID;
			fc.pids = parse_nums_list(optarg, &fc.pids_size);