Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Milgram <mmilgram@redhat.com>
To: kexec@lists.infradead.org
Cc: Marc Milgram <mmilgram@redhat.com>
Subject: makedumpfile: optimize is_zero_page
Date: Mon, 3 Mar 2014 14:44:12 -0500	[thread overview]
Message-ID: <20140303194412.7864.20862.sendpatchset@dhcp-33-231.bos.redhat.com> (raw)

There are local complaints that  filtering out only zero pages is slow.  I
found that is_zero_page was inefficient.  It checks if the page contains any
non-zero bytes - one byte at a time.

Improve performance by checking for non-zero data 64 bits at a time.  Also,
unroll the loop for additional performance.

Did testing in x86_64 mode on an Intel Xeon x5560 system with 18GB RAM.
Executed:
  time makedumpfile -d 1 /proc/vmcore <destination>

The amount of time taken in User space was reduced by 75%.  The total time to
dump memory was reduced by 28%.

is_zero_page 
Signed-off-by: Marc Milgram <mmilgram at redhat.com>
---
diff --git a/makedumpfile.h b/makedumpfile.h
index 3d270c6..0f211c4 100644
--- a/makedumpfile.h
+++ b/makedumpfile.h
@@ -1634,10 +1634,27 @@ static inline int
 is_zero_page(unsigned char *buf, long page_size)
 {
 	size_t i;
+	unsigned long long *vect = (unsigned long long *) buf;
+	long page_len = page_size / (sizeof(unsigned long long));
 
-	for (i = 0; i < page_size; i++)
-		if (buf[i])
+	for (i = 0; i < page_len; i+=8) {
+		if (vect[i])
 			return FALSE;
+		if (vect[i+1])
+			return FALSE;
+		if (vect[i+2])
+			return FALSE;
+		if (vect[i+3])
+			return FALSE;
+		if (vect[i+4])
+			return FALSE;
+		if (vect[i+5])
+			return FALSE;
+		if (vect[i+6])
+			return FALSE;
+		if (vect[i+7])
+			return FALSE;
+	}
 	return TRUE;
 }
 

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

             reply	other threads:[~2014-03-03 19:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-03 19:44 Marc Milgram [this message]
2014-03-05  4:55 ` makedumpfile: optimize is_zero_page Atsushi Kumagai
  -- strict thread matches above, loose matches on Subject: below --
2014-03-05 14:49 Marc Milgram
2014-03-10  5:25 ` Atsushi Kumagai

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=20140303194412.7864.20862.sendpatchset@dhcp-33-231.bos.redhat.com \
    --to=mmilgram@redhat.com \
    --cc=kexec@lists.infradead.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