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