提交 bb86a733 编写于 作者: A Alex Chiang 提交者: Linus Torvalds

page-types: exit early when invoked with -d|--describe

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: NAlex Chiang <achiang@hp.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Haicheng Li <haicheng.li@intel.com>
Acked-by: NWu Fengguang <fengguang.wu@intel.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 9fdcd886
...@@ -940,9 +940,8 @@ int main(int argc, char *argv[]) ...@@ -940,9 +940,8 @@ int main(int argc, char *argv[])
parse_bits_mask(optarg); parse_bits_mask(optarg);
break; break;
case 'd': case 'd':
opt_no_summary = 1;
describe_flags(optarg); describe_flags(optarg);
break; exit(0);
case 'l': case 'l':
opt_list = 1; opt_list = 1;
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册