Skip to content

Commit

Permalink
page-types: exit early when invoked with -d|--describe
Browse files Browse the repository at this point in the history
On a system with large amount of memory (256GB), invoking page-types can
take quite a long time, which is unreasonable considering the user only
wants a description of the flags:

	# time ./page-types -d 0x10
	0x0000000000000010	____D_____________________________	dirty

	real	0m34.285s
	user	0m1.966s
	sys	0m32.313s

This is because we still walk the entire address range.

Exiting early seems like a reasonble solution:

# time ./page-types -d 0x10
	0x0000000000000010	____D_____________________________	dirty

	real	0m0.007s
	user	0m0.001s
	sys	0m0.005s

Signed-off-by: Alex Chiang <achiang@hp.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Haicheng Li <haicheng.li@intel.com>
Acked-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Alex Chiang authored and Linus Torvalds committed Dec 15, 2009
1 parent 9fdcd88 commit bb86a73
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Documentation/vm/page-types.c
Original file line number Diff line number Diff line change
Expand Up @@ -940,9 +940,8 @@ int main(int argc, char *argv[])
parse_bits_mask(optarg);
break;
case 'd':
opt_no_summary = 1;
describe_flags(optarg);
break;
exit(0);
case 'l':
opt_list = 1;
break;
Expand Down

0 comments on commit bb86a73

Please sign in to comment.