linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yajun Deng <yajun.deng@linux.dev>
To: David Hildenbrand <david@redhat.com>,
	akpm@linux-foundation.org, rppt@kernel.org
Cc: mike.kravetz@oracle.com, muchun.song@linux.dev,
	willy@infradead.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] mm: pass page count and reserved to __init_single_page
Date: Tue, 26 Sep 2023 15:57:10 +0800	[thread overview]
Message-ID: <b6f0abbc-91e3-6561-a1ba-09048a999161@linux.dev> (raw)
In-Reply-To: <9777812e-c8c8-2105-cd2c-443438786172@redhat.com>


On 2023/9/26 15:44, David Hildenbrand wrote:
> On 26.09.23 04:33, Yajun Deng wrote:
>> When we init a single page, we need to mark this page reserved if it
>> does. 
>
> I failed to parse the last part of this sentence.
>
>> And some pages may not need to set page count, such as compound
>> pages.
>
> Usually, the refcount of all tail pages *must* be zero. Otherwise, 
> get_page_unless_zero() would work on tail pages.
>
> Can you elaborate why it should be okay here?
>
>
It means the following code in memmap_init_compound().

-               __init_zone_device_page(page, pfn, zone_idx, nid, pgmap);
+               __init_zone_device_page(page, pfn, zone_idx, nid, pgmap, 0);
                 prep_compound_tail(head, pfn - head_pfn);
                 set_page_count(page, 0);

As we can see, it will reset the page count by 'set_page_count(page, 0)'.

Therefore, we don't need to set page count in __init_zone_device_page(). 
I wasn't clear enough in the commit.

Maybe we can remove the 'set_page_count(page, 0)',  But I didn't do 
that, just to be safe.



  reply	other threads:[~2023-09-26  7:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-26  2:33 [PATCH v3 0/2] mm: Don't set and reset page count in MEMINIT_EARLY Yajun Deng
2023-09-26  2:33 ` [PATCH v3 2/2] mm: Init page count in reserve_bootmem_region when MEMINIT_EARLY Yajun Deng
     [not found] ` <20230926023341.991124-2-yajun.deng@linux.dev>
2023-09-26  7:44   ` [PATCH v3 1/2] mm: pass page count and reserved to __init_single_page David Hildenbrand
2023-09-26  7:57     ` Yajun Deng [this message]
2023-09-28  5:30   ` Mike Rapoport

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=b6f0abbc-91e3-6561-a1ba-09048a999161@linux.dev \
    --to=yajun.deng@linux.dev \
    --cc=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 \
    /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