[PATCH makedumpfile 1/9] Do not call extensions for tail pages
Stephen Brennan <[email protected]>
| Newsgroups | org.infradead.lists.kexec |
|---|---|
| Message-ID | <[email protected]> |
Currently, extensions are called for every page, including compound tails. But as it is currently implemented, once a compound head is excluded, makedumpfile will create an exclusion for the entire compound page range. If an extension returns PG_INCLUDE for a tail page, the bitmap is not amended, so the tail page may still be excluded. Thus, the only time an extension's decision is respected is when it is processing the head page. Similarly, if an extension return PG_EXCLUDE on an included tail page, no exclusion will be created, since the compound_head check will skip ahead. We could fix this by overwriting the 2nd bitmap's bits for a tail page when extensions return PG_INCLUDE or PG_EXCLUDE, thus overriding the prior decision. However, that doesn't seem like the right approach. Even if an extension cares to partially include a compound page, it's simpler to keep the decision making localized to the head page. This makes it easier to account the pages which are included/excluded, and ensures that we can persist any necessary state across cycles for cyclic processing. The downside is that we may need to implement more specific ways for the extension to include or exclude tail pages. Signed-off-by: Stephen Brennan <[email protected]> --- makedumpfile.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/makedumpfile.c b/makedumpfile.c index 46d9ac7..e882b84 100644 --- a/makedumpfile.c +++ b/makedumpfile.c @@ -6543,14 +6543,6 @@ __exclude_unnecessary_pages(unsigned long mem_map, pfn_read_end = pfn + pfn_mm - 1; } - /* - * Include pages that specified by user via - * makedumpfile extensions - */ - filter_pg = run_extension_callback(pfn, pcache); - if (filter_pg == PG_INCLUDE) - continue; - flags = ULONG(pcache + OFFSET(page.flags)); _count = UINT(pcache + OFFSET(page._refcount)); mapping = ULONG(pcache + OFFSET(page.mapping)); @@ -6637,14 +6629,22 @@ check_order: * Excludable compound tail pages must have already been excluded by * exclude_range(), don't need to check them here. */ - if (compound_head & 1) { + if (compound_head & 1) continue; - } + + /* + * Include pages that specified by user via + * makedumpfile extensions + */ + filter_pg = run_extension_callback(pfn, pcache); + if (filter_pg == PG_INCLUDE) + continue; + /* * Exclude the free page managed by a buddy * Use buddy identification of free pages whether cyclic or not. */ - else if ((info->dump_level & DL_EXCLUDE_FREE) + if ((info->dump_level & DL_EXCLUDE_FREE) && info->page_is_buddy && info->page_is_buddy(flags, _mapcount, private, _count)) { if ((ARRAY_LENGTH(zone.free_area) != NOT_FOUND_STRUCTURE) && -- 2.47.3