[PATCH v2] makedumpfile: Exclude unnecessary hugepages.

Baoquan He bhe at redhat.com
Sun Jul 13 23:30:18 PDT 2014


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.

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);
> +			}
>  		}



More information about the kexec mailing list