[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20230925081043.b4256d18f150e54ee7cb9c99@linux-foundation.org>
Date: Mon, 25 Sep 2023 08:10:43 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Yajun Deng <yajun.deng@...ux.dev>
Cc: rppt@...nel.org, mike.kravetz@...cle.com, muchun.song@...ux.dev,
willy@...radead.org, david@...hat.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/2] mm: pass page count and reserved to
__init_single_page
On Mon, 25 Sep 2023 15:21:49 +0800 Yajun Deng <yajun.deng@...ux.dev> 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'.
Powered by blists - more mailing lists