public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Chiang <achiang@hp.com>
To: akpm@linux-foundation.org, fengguang.wu@intel.com
Cc: Haicheng Li <haicheng.li@intel.com>,
	linux-mm@kvack.org, Andi Kleen <andi@firstfloor.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/3] page-types: exit early when invoked with -d|--describe
Date: Thu, 05 Nov 2009 13:21:26 -0700	[thread overview]
Message-ID: <20091105202126.25492.84269.stgit@bob.kio> (raw)
In-Reply-To: <20091105201846.25492.52935.stgit@bob.kio>

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

Cc: Andi Kleen <andi@firstfloor.org>
Cc: Haicheng Li <haicheng.li@intel.com>
Signed-off-by: Alex Chiang <achiang@hp.com>
---

 Documentation/vm/page-types.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/Documentation/vm/page-types.c b/Documentation/vm/page-types.c
index 9c09eb5..9cf50ab 100644
--- a/Documentation/vm/page-types.c
+++ b/Documentation/vm/page-types.c
@@ -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;


  parent reply	other threads:[~2009-11-05 20:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-05 20:21 [PATCH v2 0/3] Documentation/vm/page-types enhancements Alex Chiang
2009-11-05 20:21 ` [PATCH v2 1/3] page-types: learn to describe flags directly from command line Alex Chiang
2009-11-06  2:13   ` Wu Fengguang
2009-11-05 20:21 ` [PATCH v2 2/3] page-types: whitespace alignment Alex Chiang
2009-11-06  2:14   ` Wu Fengguang
2009-11-05 20:21 ` Alex Chiang [this message]
2009-11-06  2:15   ` [PATCH v2 3/3] page-types: exit early when invoked with -d|--describe Wu Fengguang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091105202126.25492.84269.stgit@bob.kio \
    --to=achiang@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=fengguang.wu@intel.com \
    --cc=haicheng.li@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox