makedumpfile: request the kernel do page scans
Subsystems (2)
PATCH v2 1/1 makedumpfile: request the kernel do page scans
From: Cliff Wickman <[email protected]>
I've been experimenting with asking the kernel to scan the page tables instead of reading all those page structures through /proc/vmcore. The results are rather dramatic.
On a small, idle UV: about 4 sec. versus about 40 sec.
On a 8TB UV the unnecessary page scan takes 4 minutes, vs. about 200 min through /proc/vmcore.
This patch incorporates this scheme into version 1.5.1, so that the cyclic processing can use the kernel scans.
It also uses the page_is_buddy logic to speed the finding of free pages. And also allows makedumpfile to work as before with a kernel that does not provide /proc/vmcore_pfn_lists.
This patch:
- writes requests to new kernel file /proc/vmcore_pfn_lists
- makes request PL_REQUEST_MEMMAP to pass the crash kernel information about the boot kernel
- makes requests PL_REQUEST_FREE and PL_REQUEST_EXCLUDE, asking the kernel to return lists of PFNs
- adds page scan timing options -n -o and -t
The patch [PATCH] makedumpfile: fix to exclude_unnecessary_pages_cyclic is re-done by the below, so that patch should not be applied.
This patch depends on a kernel patch, so I'm also sending one that applies to a 3.0.13 kernel:
[PATCH] scan page tables for makedumpfile, 3.0.13 kernel
Diffed against makedumpfile-1.5.1
--- dwarf_info.c | 2 makedumpfile.c | 429 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- makedumpfile.h | 91 +++++++++++- print_info.c | 5 print_info.h | 3 5 files changed, 507 insertions(+), 23 deletions(-)
makedumpfile.h +89 -2
@@ -421,7 +421,8 @@ do { \#define KVER_MIN_SHIFT 16#define KERNEL_VERSION (x,y,z) (((x) << KVER_MAJ_SHIFT) | ((y) << KVER_MIN_SHIFT) | (z))#define OLDEST_VERSION KERNEL_VERSION(2, 6, 15)/* linux-2.6.15 */ -#define LATEST_VERSION KERNEL_VERSION(3, 4, 8)/* linux-3.4.8 */ +//define LATEST_VERSION KERNEL_VERSION(3, 4, 8)/* linux-3.4.8 */ +#define LATEST_VERSION KERNEL_VERSION(3, 7, 8)/* linux-3.4.8 */ /* * vmcoreinfo in /proc/vmcore
@@ -797,9 +798,20 @@ typedef struct { } xen_crash_info_v2_t;struct mem_map_data { +/* +* pfn_start/pfn_end are the pfn's represented by this mem_map entry. +* mem_map is the virtual address of the array of page structures +* that represent this pages. +* paddr is the physical address of that array of structures. +* ending_paddr would be (pfn_end - pfn_start) * sizeof(struct page). +* section_vaddr is the address we get from ioremap_cache(). +*/ unsigned long long pfn_start;unsigned long long pfn_end; -unsigned long mem_map; +unsigned long mem_map; +unsigned long long paddr;/* filled in by makedumpfile */ +unsigned long long ending_paddr;/* filled in by kernel */ +void *section_vaddr;/* filled in by kernel */ };struct dump_bitmap {
@@ -878,6 +890,7 @@ struct DumpInfo {int flag_rearrange;/* flag of creating dumpfile from flattened format */ int flag_split;/* splitting vmcore */ +int flag_use_kernel_lists;int flag_cyclic;/* cyclic processing to keep memory consumption */ int flag_reassemble;/* reassemble multiple dumpfiles into one */ int flag_refiltering;/* refilter from kdump-compressed file */
@@ -1393,6 +1406,80 @@ struct domain_list {unsigned int pickled_id; }; +#define PL_REQUEST_FREE 1/* request for a list of free pages */ +#define PL_REQUEST_EXCLUDE 2/* request for a list of excludable +pages */ +#define PL_REQUEST_MEMMAP 3/* request to pass in the makedumpfile +mem_map_data table */ +/* +* limit the size of the pfn list to this many pfn_element structures +*/ +#define MAX_PFN_LIST 10000 + +/* +* one element in the pfn_list +*/ +struct pfn_element { +unsigned long pfn; +unsigned long order; +}; + +/* +* a request for finding pfn's that can be excluded from the dump +* they may be pages of particular types or free pages +*/ +struct pfn_list_request { +int request;/* PL_REQUEST_FREE PL_REQUEST_EXCLUDE or */ +/* PL_REQUEST_MEMMAP */ +int debug; +unsigned long paddr;/* mem_map address for PL_REQUEST_EXCLUDE */ +unsigned long pfn_start;/* pfn represented by paddr */ +unsigned long pgdat_paddr;/* for PL_REQUEST_FREE */ +unsigned long pgdat_vaddr;/* for PL_REQUEST_FREE */ +int node;/* for PL_REQUEST_FREE */ +int exclude_bits;/* for PL_REQUEST_EXCLUDE */ +int count;/* for PL_REQUEST_EXCLUDE */ +void *reply_ptr;/* address of user's pfn_reply, for reply */ +void *pfn_list_ptr;/* address of user's pfn array (*pfn_list) */ +int map_count;/* for PL_REQUEST_MEMMAP; elements */ +int map_size;/* for PL_REQUEST_MEMMAP; bytes in table */ +void *map_ptr;/* for PL_REQUEST_MEMMAP; address of table */ +long list_size;/* for PL_REQUEST_MEMMAP negotiation */ +/* resume info: */ +int more;/* 0 for done, 1 for "there's more" */ +/* PL_REQUEST_EXCLUDE: */ +int map_index;/* slot in the mem_map array of page structs */ +/* PL_REQUEST_FREE: */ +int zone_index;/* zone within the node's pgdat_list */ +int freearea_index;/* free_area within the zone */ +int type_index;/* free_list within the free_area */ +int list_ct;/* page within the list */ +}; + +/* +* the reply from a pfn_list_request +* the list of pfn's itself is pointed to by pfn_list +*/ +struct pfn_reply { +long pfn_list_elements;/* negoiated on PL_REQUEST_MEMMAP */ +long in_pfn_list;/* returned by PL_REQUEST_EXCLUDE and +PL_REQUEST_FREE */ +/* resume info */ +int more;/* 0 == done, 1 == there is more */ +/* PL_REQUEST_MEMMAP: */ +int map_index;/* slot in the mem_map array of page structs */ +/* PL_REQUEST_FREE: */ +int zone_index;/* zone within the node's pgdat_list */ +int freearea_index;/* free_area within the zone */ +int type_index;/* free_list within the free_area */ +int list_ct;/* page within the list */ +/* statistic counters: */ +unsigned long long pfn_cache;/* PL_REQUEST_EXCLUDE */ +unsigned long long pfn_cache_private;/* PL_REQUEST_EXCLUDE */ +unsigned long long pfn_user;/* PL_REQUEST_EXCLUDE */ +unsigned long long pfn_free;/* PL_REQUEST_FREE */ +}; +#define PAGES_PER_MAPWORD (sizeof(unsigned long) * 8)#define MFNS_PER_FRAME (info->page_size / sizeof(unsigned long))
dwarf_info.c +2 -0
@@ -350,6 +350,8 @@ get_data_member_location(Dwarf_Die *die,return TRUE; } +int dwarf_formref (Dwarf_Attribute *,Dwarf_Off *); +static int get_die_type (Dwarf_Die *die,Dwarf_Die *die_type) {
print_info.c +5 -0
@@ -244,6 +244,11 @@ print_usage(void)MSG (" [-f]:\n" );MSG (" Overwrite DUMPFILE even if it already exists.\n" );MSG ("\n" ); +MSG (" [-o]:\n" ); +MSG (" Read page structures from /proc/vmcore in the scan for\n" ); +MSG (" free and excluded pages regardless of whether\n" ); +MSG (" /proc/vmcore_pfn_lists is present.\n" ); +MSG ("\n" );MSG (" [-h]:\n" );MSG (" Show help message and LZO/snappy support status (enabled/disabled).\n" );MSG ("\n" );
print_info.h +2 -1
@@ -43,7 +43,8 @@ void print_execution_time(char *step_nam*/ #define MIN_MSG_LEVEL (0)#define MAX_MSG_LEVEL (31) -#define DEFAULT_MSG_LEVEL (7)/* Print the progress indicator, the +// cpw: was 7 but add x10 for testing +#define DEFAULT_MSG_LEVEL (23)/* Print the progress indicator, the common message, the error message */ #define ML_PRINT_PROGRESS (0x001)/* Print the progress indicator */ #define ML_PRINT_COMMON_MSG (0x002)/* Print the common message */
makedumpfile.c +409 -20
622 lines not on this page · raw message
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Hello Cliff,
I'm interested in this and I'll test this patch on our machine with 2TB machines, though I need to start reservating environment, report would be posted one or two weeks later.
On my requirement there is the case where dump filtering cannot be used. Then dumpfile size becomes large and copying performance becomes crutial not only for page scans but also writing processing, i.e. copies, compresses and writs pages. I thought such work should probably be done on kernel much more than now, but I didn't start this investigation now.
Quoted 7 lines
-----Original Message-----
From: Cliff Wickman [mailto:[email protected]]
Sent: Thursday, November 22, 2012 5:07 AM
To: Hatayama, Daisuke/畑山 大輔; [email protected]
Cc: [email protected]
Subject: [PATCH v2] makedumpfile: request the kernel do page scans
Quoted 9 lines
From: Cliff Wickman <[email protected]>
I've been experimenting with asking the kernel to scan the page tables instead of reading all those page structures through
/proc/vmcore. The results are rather dramatic.
On a small, idle UV: about 4 sec. versus about 40 sec.
On a 8TB UV the unnecessary page scan takes 4 minutes, vs. about 200 min through/proc/vmcore.
In the other mail, you explained the reason why this performance difference occurs. But I don't understand the term ``units'' you used. Or it might be better for me some kind of benchmark results, e.g with perf stat, showing the difference in seconds even if the unit is really not essential.
Quoted 31 lines
makedumpfile.h +19
-0+/* +* limit the size of the pfn list to this many pfn_element structures +*/ +#define MAX_PFN_LIST 10000 + +/* +* one element in the pfn_list +*/ +struct pfn_element { +unsigned long pfn; +unsigned long order; +}; + +/* +* a request for finding pfn's that can be excluded from the dump +* they may be pages of particular types or free pages +*/ +struct pfn_list_request { +int request;/* PL_REQUEST_FREE PL_REQUEST_EXCLUDE or */
makedumpfile.h +3
-0+/* PL_REQUEST_MEMMAP */ +int debug; +unsigned long paddr;/* mem_map address for
PL_REQUEST_EXCLUDE*/makedumpfile.h +7
-0+unsigned long pfn_start;/* pfn represented by paddr */ +unsigned long pgdat_paddr;/* for PL_REQUEST_FREE */ +unsigned long pgdat_vaddr;/* for PL_REQUEST_FREE */ +int node;/* for PL_REQUEST_FREE */ +int exclude_bits;/* for PL_REQUEST_EXCLUDE */ +int count;/* for PL_REQUEST_EXCLUDE */ +void *reply_ptr;/* address of user's pfn_reply, for reply
Quoted 1 line
*/
How about passing bitmap instead of lists and making kernel side unset bits corresponding to unnecessary pages? It's less coping and constant.
Thanks.
HATAYAMA, Daisuke
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
From: "Hatayama, Daisuke" <[email protected]>
Subject: RE: [PATCH v2] makedumpfile: request the kernel do page scans
Date: Thu, 22 Nov 2012 01:43:39 +0000
[...]
Quoted 27 lines
Quoted 27 lines
makedumpfile.h +19
-0+/* +* limit the size of the pfn list to this many pfn_element structures +*/ +#define MAX_PFN_LIST 10000 + +/* +* one element in the pfn_list +*/ +struct pfn_element { +unsigned long pfn; +unsigned long order; +}; + +/* +* a request for finding pfn's that can be excluded from the dump +* they may be pages of particular types or free pages +*/ +struct pfn_list_request { +int request;/* PL_REQUEST_FREE PL_REQUEST_EXCLUDE or */
makedumpfile.h +3
-0+/* PL_REQUEST_MEMMAP */ +int debug; +unsigned long paddr;/* mem_map address for
PL_REQUEST_EXCLUDE*/makedumpfile.h +3
-0+unsigned long pfn_start;/* pfn represented by paddr */ +unsigned long pgdat_paddr;/* for PL_REQUEST_FREE */ +unsigned long pgdat_vaddr;/* for PL_REQUEST_FREE */
Quoted 9 lines
Quoted 5 lines
makedumpfile.h +4
-0+int node;/* for PL_REQUEST_FREE */ +int exclude_bits;/* for PL_REQUEST_EXCLUDE */ +int count;/* for PL_REQUEST_EXCLUDE */ +void *reply_ptr;/* address of user's pfn_reply, for reply */
How about passing bitmap instead of lists and making kernel side unset bits corresponding to unnecessary pages? It's less coping and constant.
Again, there's also small memory issue. makedumpfile v1.5.1 calculates cyclic buffer size automatically from MemFree in /proc/meminfo. It's 40% of MemFree. There are two bitmaps so 80% is used in total.
Now, if passing bitmap as usual, copy_from_user() would be used. But then, kernel space needs to prepare buffer of the cyclic buffer size. It's 120% in total.
Alternatively, my idea is to export bitmap from kernel-space, and from makedumpfile, mmap it, read it and then updates it each time one cycle ends.
Thanks.
HATAYAMA, Daisuke
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
An update on testing thise patches:
Quoted 4 lines
This version of the patch improves the consolidation of the
mem_maptable that is passed to the kernel. Seemake_kernel_mmap(). Particularly the seemingly duplicate pfn ranges generated on an older (2.6.32-based, rhel6) kernel.
On a 2TB machine (idle) machine:
the crash kernel ran successfully in 512M the scan for unnecessary pages takes about 40 seconds it was a single scan, not cyclic
On a 16TB machine (idle) machine:
the crash kernel ran successfully in 512M
there is a pause of about 4 minutes during makedumpfile initialization the scan for unnecessary pages takes about 4.8 minutes
it was a single scan, not cyclic
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
From: Cliff Wickman <[email protected]>
Subject: Re: [PATCH v2] makedumpfile: request the kernel do page scans
Date: Mon, 7 Jan 2013 07:39:35 -0600
Quoted 13 lines
An update on testing thise patches:
Quoted 4 lines
This version of the patch improves the consolidation of the
mem_maptable that is passed to the kernel. Seemake_kernel_mmap(). Particularly the seemingly duplicate pfn ranges generated on an older (2.6.32-based, rhel6) kernel.On a 2TB machine (idle) machine:
the crash kernel ran successfully in 512M the scan for unnecessary pages takes about 40 seconds it was a single scan, not cyclic
Quoted 6 lines
On a 16TB machine (idle) machine:
the crash kernel ran successfully in 512M
there is a pause of about 4 minutes during makedumpfile initialization the scan for unnecessary pages takes about 4.8 minutes
it was a single scan, not cyclic
I wonder why this didn't result in OOM on 16TB. Was that really done in non-cyclic mode? Could you show me a log of makedumpfile? You can create it by passing --message-level 31.
Also, to consider how to resolve this performance issue, this test is not enough. We also need to benchmark that *without filtering in kernel-space* but with making page tables, not using ioremap. As I said before, I think the bad performance is caused by too many calls of ioremap/iounmap. We then need to comapre two results of these benchmarks.
Thanks.
HATAYAMA, Daisuke
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
A message that is not in the archive (sent off-list or not yet received): [email protected]
From: Cliff Wickman <[email protected]>
Subject: Re: [PATCH v2] makedumpfile: request the kernel do page scans
Date: Fri, 11 Jan 2013 16:30:34 -0600
Quoted 2 lines
Hi Hatayama,
Hello Cliff,
Sorry, I failed to reply this to you. I have not noticed error mail returned back to from system...
First, today I sent the RFC patch set focussing on mapping vmcore regions in direct mapping region. Please see it. I signed off the 2nd patch with your signature because I reused your code constructing page tables.
Quoted 25 lines · HATAYAMA Daisuke
Quoted 24 lines
From: Cliff Wickman <[email protected]>
Subject: Re: [PATCH v2] makedumpfile: request the kernel do page scans
Date: Mon, 7 Jan 2013 07:39:35 -0600Quoted 19 lines
An update on testing thise patches:
Quoted 4 lines
This version of the patch improves the consolidation of the
mem_maptable that is passed to the kernel. Seemake_kernel_mmap(). Particularly the seemingly duplicate pfn ranges generated on an older (2.6.32-based, rhel6) kernel.On a 2TB machine (idle) machine:
the crash kernel ran successfully in 512M the scan for unnecessary pages takes about 40 seconds it was a single scan, not cyclicOn a 16TB machine (idle) machine:
the crash kernel ran successfully in 512M
there is a pause of about 4 minutes during makedumpfile initialization the scan for unnecessary pages takes about 4.8 minutes
it was a single scan, not cyclic
Quoted 8 lines
Quoted 3 lines
I wonder why this didn't result in OOM on 16TB. Was that really done in non-cyclic mode? Could you show me a log of makedumpfile? You can create it by passing --message-level 31.
The test was done in non-cyclic mode.
But I had changed the kernel patch to do a direct mapping of the page structures, rather than using ioremap.
Then, I still wonder why this didn't result in OOM. This OOM is not caused by memory consumption of page table, by two bitmaps of makedumpfile that grows in proportion to memory size. On 2TB, there are 64MB two bitmaps and on 16TB, there are 512MB two bitmaps.
Quoted 3 lines
I'll attach the kernel patch and the makedumpfile patch, if you would like to test them.
(2 kernel patches, one for 2.6.32-based and one for 3.0.13-based)
As I said some times previously, I have already tried your patch set on local machine. See the url below, where I attached result profiling your patch set with perf record.
http://lists.infradead.org/pipermail/kexec/2012-December/007500.html
Quoted 4 lines
I'm also experimenting with the same interface to copy pages back to makedumpfile without using
/proc/vmcore. There is some improvement there. I just now dumped a 2TB idle system (it wrote a 3.6GB dump file).
So, I have already understood your patch is effective for this issue but I have continued to say that this is mainly caused by calling ioremap too many times. IOW, I guess the performance improvement you saw is mostly by remapping a whole memory by ioremap at the same time.
Quoted 2 lines
The copy phase took 7:12 with the direct copy, 8:35 using
/proc/vmcore. I'll attach that patch too.
Please show us more detailed results. I don't know how you did this benchmark and how I should evaluate this.
I also think that makedumpfile also does IO. Improvement of a few minutes seems a small impact, not enough for porting filtering into kernel-space.
Thanks.
HATAYAMA, Daisuke
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec