[PATCH v1 1/5] makedumpfile: Add support for block
Zhou Wenjian
zhouwj-fnst at cn.fujitsu.com
Mon Sep 29 00:06:23 PDT 2014
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 Block
exists. Struct Block is designed to manage memory, mainly for recording
the number of dumpable pages. We can use the number of dumpable pages to
calculate start and end pfn instead of execute excluding for the whole
memory.
The char array *table in struct Block is used to record the number of
dumpable pages.
The table entry size is calculated as
divideup(log2(block_size / page_size), 8) bytes
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 block is big enough.
Signed-off-by: Qiao Nuohan <qiaonuohan at cn.fujitsu.com>
Signed-off-by: Zhou Wenjian <zhouwj-fnst at cn.fujitsu.com>
---
makedumpfile.c | 23 +++++++++++++++++++++++
makedumpfile.h | 14 ++++++++++++++
2 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/makedumpfile.c b/makedumpfile.c
index b4d43d8..2feda01 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -34,6 +34,7 @@ struct srcfile_table srcfile_table;
struct vm_table vt = { 0 };
struct DumpInfo *info = NULL;
+struct Block *block = NULL;
char filename_stdout[] = FILENAME_STDOUT;
@@ -5685,6 +5686,28 @@ out:
return ret;
}
+/*
+ * cyclic_split mode:
+ * manage memory by blocks,
+ * divide memory into blocks
+ * use block_table to record numbers of dumpable pages in each block
+ */
+
+//calculate entry size based on the amount of pages in one block
+int
+calculate_entry_size(void){
+ int entry_num = 1, count = 1;
+ int entry_size;
+ while (entry_num < block->page_per_block){
+ 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.h b/makedumpfile.h
index 96830b0..ed4f799 100644
--- a/makedumpfile.h
+++ b/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 block_size
+ */
+ long long block_size;
};
extern struct DumpInfo *info;
/*
+ *for cyclic_splitting mode,Manage memory by block
+ */
+struct Block{
+ char *table;
+ long long num;
+ long long page_per_block;
+ int entry_size; //counted by byte
+};
+
+/*
* kernel VM-related data
*/
struct vm_table {
--
1.7.1
More information about the kexec
mailing list