Blame SOURCES/kexec-tools-2.0.8-makedumpfile-Add-support-for-splitblock.patch

a6d77e
Return-Path: yishimat@redhat.com
a6d77e
Received: from zmta05.collab.prod.int.phx2.redhat.com (LHLO
a6d77e
 zmta05.collab.prod.int.phx2.redhat.com) (10.5.81.12) by
a6d77e
 zmail24.collab.prod.int.phx2.redhat.com with LMTP; Thu, 2 Jul 2015 01:06:36
a6d77e
 -0400 (EDT)
a6d77e
Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26])
a6d77e
	by zmta05.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 9A5FA17C114;
a6d77e
	Thu,  2 Jul 2015 01:06:36 -0400 (EDT)
a6d77e
Received: from [10.3.112.13] ([10.3.112.13])
a6d77e
	by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6256Wbm025889;
a6d77e
	Thu, 2 Jul 2015 01:06:33 -0400
a6d77e
Subject: [RHEL7.2 PATCH resend v3 1/5] Add support for splitblock.
a6d77e
To: kexec-kdump-list@redhat.com
a6d77e
References: <55929D94.4020500@redhat.com> <5594C62C.3030407@redhat.com>
a6d77e
Cc: Minfei Huang <mhuang@redhat.com>, bhe@redhat.com, yishimat@redhat.com
a6d77e
From: Yasuaki Ishimatsu <yishimat@redhat.com>
a6d77e
Message-ID: <5594C6D8.5060601@redhat.com>
a6d77e
Date: Thu, 2 Jul 2015 01:06:32 -0400
a6d77e
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101
a6d77e
 Thunderbird/38.0.1
a6d77e
MIME-Version: 1.0
a6d77e
In-Reply-To: <5594C62C.3030407@redhat.com>
a6d77e
Content-Type: text/plain; charset=utf-8
a6d77e
Content-Transfer-Encoding: 7bit
a6d77e
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26
a6d77e
Content-Length: 3498
a6d77e
a6d77e
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1182379
a6d77e
a6d77e
The patch is back ported directory from the following upstream commit:
a6d77e
a6d77e
commit c7825d45999daf09bd89a08d08219261023dcf11
a6d77e
Author: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com>
a6d77e
Date:   Fri Nov 7 09:42:18 2014 +0900
a6d77e
a6d77e
    [PATCH v5 1/5] Add support for splitblock.
a6d77e
a6d77e
    When --split option is specified, fair I/O workloads shoud be assigned
a6d77e
    for each process. So the start and end pfn of each dumpfile should be
a6d77e
    calculated with excluding unnecessary pages. However, it costs a lot of
a6d77e
    time to execute excluding for the whole memory. That is why struct
a6d77e
    SplitBlock exists. Struct SplitBlock is designed to manage memory, main
a6d77e
    for recording the number of dumpable pages. We can use the number of
a6d77e
    dumpable pages to calculate start and end pfn instead of execute exclud
a6d77e
    for the whole memory.
a6d77e
a6d77e
    The char array *table in struct SplitBlock is used to record the number
a6d77e
    dumpable pages.
a6d77e
    The table entry size is calculated as
a6d77e
                            divideup(log2(splitblock_size / page_size), 8)
a6d77e
    The table entry size is calculated, so that the
a6d77e
    space table taken will be small enough. And the code will also have a
a6d77e
    good performence when the number of pages in one splitblock is big enou
a6d77e
a6d77e
    Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
a6d77e
    Signed-off-by: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com>
a6d77e
a6d77e
Resolves: rhbz#1182379
a6d77e
Signed-off-by: Yasuaki Ishimatsu <yishimat@redhat.com>
a6d77e
a6d77e
---
a6d77e
 makedumpfile-1.5.7/makedumpfile.c |   31 +++++++++++++++++++++++++++++++
a6d77e
 makedumpfile-1.5.7/makedumpfile.h |   14 ++++++++++++++
a6d77e
 2 files changed, 45 insertions(+), 0 deletions(-)
a6d77e
a6d77e
diff --git a/makedumpfile-1.5.7/makedumpfile.c b/makedumpfile-1.5.7/makedumpfile.c
a6d77e
index b4d43d8..a4c3eee 100644
a6d77e
--- a/makedumpfile-1.5.7/makedumpfile.c
a6d77e
+++ b/makedumpfile-1.5.7/makedumpfile.c
a6d77e
@@ -34,6 +34,7 @@ struct srcfile_table	srcfile_table;
a6d77e
a6d77e
 struct vm_table		vt = { 0 };
a6d77e
 struct DumpInfo		*info = NULL;
a6d77e
+struct SplitBlock		*splitblock = NULL;
a6d77e
a6d77e
 char filename_stdout[] = FILENAME_STDOUT;
a6d77e
a6d77e
@@ -5685,6 +5686,36 @@ out:
a6d77e
 	return ret;
a6d77e
 }
a6d77e
a6d77e
+/*
a6d77e
+ * cyclic_split mode:
a6d77e
+ *	manage memory by splitblocks,
a6d77e
+ *	divide memory into splitblocks
a6d77e
+ *	use splitblock_table to record numbers of dumpable pages in each
a6d77e
+ *	splitblock
a6d77e
+ */
a6d77e
+
a6d77e
+/*
a6d77e
+ * calculate entry size based on the amount of pages in one splitblock
a6d77e
+ */
a6d77e
+int
a6d77e
+calculate_entry_size(void)
a6d77e
+{
a6d77e
+	int entry_num = 1;
a6d77e
+	int count = 1;
a6d77e
+	int entry_size;
a6d77e
+
a6d77e
+	while (entry_num < splitblock->page_per_splitblock) {
a6d77e
+		entry_num = entry_num << 1;
a6d77e
+		count++;
a6d77e
+	}
a6d77e
+
a6d77e
+	entry_size = count / BITPERBYTE;
a6d77e
+	if (count % BITPERBYTE)
a6d77e
+		entry_size++;
a6d77e
+
a6d77e
+	return entry_size;
a6d77e
+}
a6d77e
+
a6d77e
 mdf_pfn_t
a6d77e
 get_num_dumpable(void)
a6d77e
 {
a6d77e
diff --git a/makedumpfile-1.5.7/makedumpfile.h b/makedumpfile-1.5.7/makedumpfile.h
a6d77e
index 96830b0..a263631 100644
a6d77e
--- a/makedumpfile-1.5.7/makedumpfile.h
a6d77e
+++ b/makedumpfile-1.5.7/makedumpfile.h
a6d77e
@@ -1168,10 +1168,24 @@ struct DumpInfo {
a6d77e
 	 */
a6d77e
 	int (*page_is_buddy)(unsigned long flags, unsigned int _mapcount,
a6d77e
 			     unsigned long private, unsigned int _count);
a6d77e
+	/*
a6d77e
+	 * for cyclic_splitting mode, setup splitblock_size
a6d77e
+	 */
a6d77e
+	long long splitblock_size;
a6d77e
 };
a6d77e
 extern struct DumpInfo		*info;
a6d77e
a6d77e
 /*
a6d77e
+ * for cyclic_splitting mode,Manage memory by splitblock
a6d77e
+ */
a6d77e
+struct SplitBlock {
a6d77e
+	char *table;
a6d77e
+	long long num;
a6d77e
+	long long page_per_splitblock;
a6d77e
+	int entry_size;                 /* counted by byte */
a6d77e
+};
a6d77e
+
a6d77e
+/*
a6d77e
  * kernel VM-related data
a6d77e
  */
a6d77e
 struct vm_table {
a6d77e
-- 
a6d77e
1.7.1
a6d77e