[PATCH v3] makedumpfile: Exclude unnecessary hugepages.

Baoquan He bhe at redhat.com
Thu Jul 24 23:00:45 PDT 2014


Hi Atsushi,

Patch looks good. Only a small concern.


 +	mdf_pfn_t nr_pages;
>  	unsigned long index_pg, pfn_mm;
>  	unsigned long long maddr;
>  	mdf_pfn_t pfn_read_start, pfn_read_end;
>  	unsigned char page_cache[SIZE(page) * PGMM_CACHED];
>  	unsigned char *pcache;
> -	unsigned int _count, _mapcount = 0;
> +	unsigned int _count, _mapcount = 0, compound_order = 0;
>  	unsigned long flags, mapping, private = 0;
> +	unsigned long hugetlb_dtor;
                      ~~~~~~~~~~~~~
>  
>  	/*
>  	 * If a multi-page exclusion is pending, do it first
> @@ -4708,11 +4728,36 @@ __exclude_unnecessary_pages(unsigned long mem_map,
>  		flags   = ULONG(pcache + OFFSET(page.flags));
>  		_count  = UINT(pcache + OFFSET(page._count));
>  		mapping = ULONG(pcache + OFFSET(page.mapping));
> +
> +		if (index_pg < PGMM_CACHED - 1) {
> +			compound_order = ULONG(pcache + SIZE(page) + OFFSET(page.lru)
> +					       + OFFSET(list_head.prev));
> +			hugetlb_dtor = ULONG(pcache + SIZE(page) + OFFSET(page.lru)
> +					     + OFFSET(list_head.next));

Here I think the variable should be compound_page_dtor because it could
be free_compound_page if it's thp or normal huge page. Only if it's a
hugetlb huge page, it will be free_huge_page. So for removing confusion
and future extention, it could be named as compound_page_dtor or
compound_dtor, a more generic name.

Thanks
Baoquan


> +
> +			if (compound_order &&
> +			    ((compound_order >= sizeof(unsigned long) * 8)
> +			     || (pfn & ((1UL << compound_order) - 1)) != 0)) {
> +				/* Invalid order */
> +				compound_order = 0;
> +			}



More information about the kexec mailing list