From: Zhou Wenjian <zhouwj-fnst@xxxxxxxxxxxxxx> Subject: [PATCH v2 1/5] Add support for splitblock Date: Mon, 13 Oct 2014 17:34:22 +0800 > 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, 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 SplitBlock is used to record the number of > dumpable pages. > The table entry size is calculated as > divideup(log2(splitblock_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 splitblock 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..95d553c 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 SplitBlock *splitblock = NULL; > > char filename_stdout[] = FILENAME_STDOUT; > > @@ -5685,6 +5686,28 @@ 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 Please use /* */ style in comment just as other parts of makedumpfile source codes. > +int > +calculate_entry_size(void){ Please add linebreak. calculate_entry_size(void) { > + int entry_num = 1, count = 1; > + int entry_size; Please add linebreak. > + 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.h b/makedumpfile.h > index 96830b0..98b8404 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 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 Please use /* */. > +}; > + > +/* > * kernel VM-related data > */ > struct vm_table { > -- > 1.7.1 > > > _______________________________________________ > kexec mailing list > kexec at lists.infradead.org > http://lists.infradead.org/mailman/listinfo/kexec -- Thanks. HATAYAMA, Daisuke