From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mx1.redhat.com ([209.132.183.28]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WLD9I-00046v-08 for kexec@lists.infradead.org; Wed, 05 Mar 2014 14:50:20 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s25EnwwP012947 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 5 Mar 2014 09:49:58 -0500 Date: Wed, 5 Mar 2014 09:49:57 -0500 From: Marc Milgram Message-Id: <20140305144957.18703.41199.sendpatchset@dhcp-33-231.bos.redhat.com> Subject: makedumpfile: optimize is_zero_page List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=twosheds.infradead.org@lists.infradead.org To: kexec@lists.infradead.org Cc: Marc Milgram 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. Did testing in x86_64 mode on an Intel Xeon x5560 system with 18GB RAM. Executed: time makedumpfile -d 1 /proc/vmcore The amount of time taken in User space was reduced by 64%. The total time to dump memory was reduced by 27%. Change Log: v1 => v2) o Eliminate loop unrolling as it is of minimal benefit based on CPU. is_zero_page Signed-off-by: Marc Milgram --- diff --git a/makedumpfile.h b/makedumpfile.h index 3d270c6..1751e3a 100644 --- a/makedumpfile.h +++ b/makedumpfile.h @@ -1634,9 +1634,11 @@ 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++) + if (vect[i]) return FALSE; return TRUE; } _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec