Tag ABD pages for exclusion in kernel crash dumps

Tag the ABD data pages so that they can be identified for exclusion 
from kernel crash dumps. Eliminating the zfs file data allows for 
significantly smaller crash dump files. Note that ZFS in illumos has 
always excluded the zfs data pages from a kernel crash dump.

This change tags ARC scatter data pages so they can be identified from 
the makedumpfile(8) command. That command is used to create smaller 
dump files by ignoring some memory regions and using compression. It 
already filters file data from the VFS page cache and will now be able 
to exclude ZFS file data pages from the dump file.

A corresponding change to makeumpfile(8) is required to identify ZFS 
data pages.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by: Don Brady <don.brady@delphix.com>
Closes #8899
This commit is contained in:
Don Brady 2019-08-28 11:44:46 -06:00 committed by Brian Behlendorf
parent 035e96118b
commit 28c91ab66d
1 changed files with 29 additions and 0 deletions

View File

@ -245,6 +245,32 @@ abd_chunkcnt_for_bytes(size_t size)
} }
#ifdef _KERNEL #ifdef _KERNEL
/*
* Mark zfs data pages so they can be excluded from kernel crash dumps
*/
#ifdef _LP64
#define ABD_FILE_CACHE_PAGE 0x2F5ABDF11ECAC4E
static inline void
abd_mark_zfs_page(struct page *page)
{
get_page(page);
SetPagePrivate(page);
set_page_private(page, ABD_FILE_CACHE_PAGE);
}
static inline void
abd_unmark_zfs_page(struct page *page)
{
set_page_private(page, 0UL);
ClearPagePrivate(page);
put_page(page);
}
#else
#define abd_mark_zfs_page(page)
#define abd_unmark_zfs_page(page)
#endif /* _LP64 */
#ifndef CONFIG_HIGHMEM #ifndef CONFIG_HIGHMEM
#ifndef __GFP_RECLAIM #ifndef __GFP_RECLAIM
@ -318,6 +344,7 @@ abd_alloc_pages(abd_t *abd, size_t size)
size_t sg_size = MIN(PAGESIZE << compound_order(page), size_t sg_size = MIN(PAGESIZE << compound_order(page),
remaining_size); remaining_size);
sg_set_page(sg, page, sg_size, 0); sg_set_page(sg, page, sg_size, 0);
abd_mark_zfs_page(page);
remaining_size -= sg_size; remaining_size -= sg_size;
sg = sg_next(sg); sg = sg_next(sg);
@ -404,6 +431,7 @@ abd_alloc_pages(abd_t *abd, size_t size)
ABDSTAT_BUMP(abdstat_scatter_orders[0]); ABDSTAT_BUMP(abdstat_scatter_orders[0]);
sg_set_page(sg, page, PAGESIZE, 0); sg_set_page(sg, page, PAGESIZE, 0);
abd_mark_zfs_page(page);
} }
if (nr_pages > 1) { if (nr_pages > 1) {
@ -430,6 +458,7 @@ abd_free_pages(abd_t *abd)
abd_for_each_sg(abd, sg, nr_pages, i) { abd_for_each_sg(abd, sg, nr_pages, i) {
page = sg_page(sg); page = sg_page(sg);
abd_unmark_zfs_page(page);
order = compound_order(page); order = compound_order(page);
__free_pages(page, order); __free_pages(page, order);
ASSERT3U(sg->length, <=, PAGE_SIZE << order); ASSERT3U(sg->length, <=, PAGE_SIZE << order);