Hello Baoquan, >On 06/17/14 at 02:32am, Atsushi Kumagai wrote: >> Hello, >> >> /* >> * Exclude the data page of the user process. >> */ >> - else if ((info->dump_level & DL_EXCLUDE_USER_DATA) >> - && isAnon(mapping)) { >> - if (clear_bit_on_2nd_bitmap_for_kernel(pfn, cycle)) >> - pfn_user++; >> + else if (info->dump_level & DL_EXCLUDE_USER_DATA) { >Hi Atsushi, > >Could it be changed to checking hugepage first, then anonymous page? >This can avoid involving the free_huge_page. > >like this: > int nr_pages; > if (page_is_hugepage(flags) { > int nr_pages = 1 << compound_order; > > exclude_range(&pfn_user, pfn, pfn + nr_pages, cycle); > > pfn += nr_pages - 1; > mem_map += (nr_pages - 1) * SIZE(page); > } else if (isAnon(mapping)) { > int nr_pages = 1; > > exclude_range(&pfn_user, pfn, pfn + nr_pages, cycle); > > pfn += nr_pages - 1; > mem_map += (nr_pages - 1) * SIZE(page); > } > >But I may not know the meaning of free_huge_page completely. If you >think introducing free_huge_page is better, I am fine too, can ACK that >kernel patch to export free_huge_page you posted. The assumption that all compound pages are user pages is wrong since some kernel pages can be compound. For example, kmalloc_large_node() calls alloc_pages_node() with __GFP_COMP. This means we have to check compound user pages without only depending on page_is_hugepage(). We can detect THPs with the combination of page_is_hugepage() and isAnon(), but it can't be applied to hugetlbfs pages. This is why we need to export free_huge_page. BTW, the v2 code can misdetect hugetlbfs due to the wrong check order, I'm going to fix it in the next version. Thanks Atsushi Kumagai >Thanks >Baoquan > >> + /* >> + * Exclude the anonymous pages as user pages. >> + */ >> + if (isAnon(mapping)) { >> + int nr_pages; >> + /* >> + * Check the compound page >> + */ >> + if (page_is_hugepage(flags) && compound_order > 0) >> + nr_pages = 1 << compound_order; >> + else >> + nr_pages = 1; >> + >> + exclude_range(&pfn_user, pfn, pfn + nr_pages, cycle); >> + >> + pfn += nr_pages - 1; >> + mem_map += (nr_pages - 1) * SIZE(page); >> + } >> + /* >> + * Exclude the hugetlbfs pages as user pages. >> + */ >> + else if (hugetlb_dtor == SYMBOL(free_huge_page)) { >> + int nr_pages = 1 << compound_order; >> + >> + exclude_range(&pfn_user, pfn, pfn + nr_pages, cycle); >> + >> + pfn += nr_pages - 1; >> + mem_map += (nr_pages - 1) * SIZE(page); >> + } >> } > >_______________________________________________ >kexec mailing list >kexec at lists.infradead.org >http://lists.infradead.org/mailman/listinfo/kexec