Re: [PATCH v2 1/2] mm: pass page count and reserved to __init_single_page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 25 Sep 2023 15:21:49 +0800 Yajun Deng <yajun.deng@xxxxxxxxx> wrote:

> When we init a single page, we need to mark this page reserved if it
> does. And some pages may not need to set page count, such as compound
> pages.
> 
> Introduce INIT_PAGE_COUNT and INIT_PAGE_RESERVED, let the caller
> decide if it needs to set page count and mark page reserved or not.
> 
> ...
>
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -3196,7 +3196,7 @@ static void __init hugetlb_folio_init_tail_vmemmap(struct folio *folio,
>  	for (pfn = head_pfn + start_page_number; pfn < end_pfn; pfn++) {
>  		struct page *page = pfn_to_page(pfn);
>  
> -		__init_single_page(page, pfn, zone, nid);
> +		__init_single_page(page, pfn, zone, nid, INIT_PAGE_COUNT);
>  		prep_compound_tail((struct page *)folio, pfn - head_pfn);
>  		ret = page_ref_freeze(page, 1);
>  		VM_BUG_ON(!ret);
> diff --git a/mm/internal.h b/mm/internal.h
> index 7a961d12b088..e9366cce461c 100644
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -1209,8 +1209,14 @@ struct vma_prepare {
>  	struct vm_area_struct *remove2;
>  };
>  
> +enum {
> +	INIT_PAGE_COUNT    = (1 << 0),
> +	INIT_PAGE_RESERVED = (1 << 1),
> +};

It would be neater to give this enum a name

>  void __meminit __init_single_page(struct page *page, unsigned long pfn,
> -				unsigned long zone, int nid);
> +				  unsigned long zone, int nid,
> +				  unsigned int flags);

Then use this enum for `flags'.






[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux