linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Yajun Deng <yajun.deng@linux.dev>
Cc: rppt@kernel.org, mike.kravetz@oracle.com, muchun.song@linux.dev,
	willy@infradead.org, david@redhat.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] mm: pass page count and reserved to __init_single_page
Date: Mon, 25 Sep 2023 08:10:43 -0700	[thread overview]
Message-ID: <20230925081043.b4256d18f150e54ee7cb9c99@linux-foundation.org> (raw)
In-Reply-To: <20230925072150.386880-2-yajun.deng@linux.dev>

On Mon, 25 Sep 2023 15:21:49 +0800 Yajun Deng <yajun.deng@linux.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'.




  reply	other threads:[~2023-09-25 15:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-25  7:21 [PATCH v2 0/2] mm: Don't set and reset page count in MEMINIT_EARLY Yajun Deng
2023-09-25  7:21 ` [PATCH v2 1/2] mm: pass page count and reserved to __init_single_page Yajun Deng
2023-09-25 15:10   ` Andrew Morton [this message]
2023-09-25  7:21 ` [PATCH v2 2/2] mm: Init page count in reserve_bootmem_region when MEMINIT_EARLY Yajun Deng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230925081043.b4256d18f150e54ee7cb9c99@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=muchun.song@linux.dev \
    --cc=rppt@kernel.org \
    --cc=willy@infradead.org \
    --cc=yajun.deng@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox