From: Muchun Song <songmuchun@bytedance.com>
To: Oscar Salvador <osalvador@suse.de>
Cc: akpm@linux-foundation.org, corbet@lwn.net, david@redhat.com,
mike.kravetz@oracle.com, paulmck@kernel.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, duanxiongchun@bytedance.com,
smuchun@gmail.com
Subject: Re: [PATCH v5 2/2] mm: memory_hotplug: make hugetlb_optimize_vmemmap compatible with memmap_on_memory
Date: Mon, 20 Jun 2022 22:15:16 +0800 [thread overview]
Message-ID: <YrCA9JIet7RulSPo@FVFYT0MHHV2J.usts.net> (raw)
In-Reply-To: <YrBz5dBpb3XTZm5c@localhost.localdomain>
On Mon, Jun 20, 2022 at 03:19:33PM +0200, Oscar Salvador wrote:
> On Mon, Jun 20, 2022 at 07:06:16PM +0800, Muchun Song wrote:
> > + /*
> > + * The READ_ONCE() is used to stabilize *pmdp in a register or
> > + * on the stack so that it will stop changing under the code.
> > + * The only concurrent operation where it can be changed is
> > + * split_vmemmap_huge_pmd() (*pmdp will be stable after this
> > + * operation).
> > + */
> > + pmd = READ_ONCE(*pmdp);
> > + if (pmd_leaf(pmd))
> > + vmemmap_page = pmd_page(pmd) + pte_index(vaddr);
> > + else
> > + vmemmap_page = pte_page(*pte_offset_kernel(pmdp, vaddr));
>
> I was about to suggest to get rid of the else branch because on x86_64
> we can only allocate PMD_SIZE chunks when using an alternative allocator,
> meaning that anything which is not a pmd_leaf can't be a PageVmemmapSelfHosted.
>
You are right. However, I think relaying on this condition is fragile and
not straightforward compared to the check of PageVmemmapSelfHosted(). And
the else branch is not in a hot path. So I'd like to stay with it. Does
this make sense for you?
> But then I went to check the other platform that supports memmap_on_memory (arm64),
> and in there I can see that we fallback to populate basepages with altmap should
> we fail to allocate a PMD_SIZE chunk.
>
I think it cannot be fail for memmap_on_memory case.
Thanks.
next prev parent reply other threads:[~2022-06-20 14:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 11:06 [PATCH v5 0/2] " Muchun Song
2022-06-20 11:06 ` [PATCH v5 1/2] mm: memory_hotplug: enumerate all supported section flags Muchun Song
2022-06-21 7:39 ` David Hildenbrand
2022-06-20 11:06 ` [PATCH v5 2/2] mm: memory_hotplug: make hugetlb_optimize_vmemmap compatible with memmap_on_memory Muchun Song
2022-06-20 13:19 ` Oscar Salvador
2022-06-20 14:15 ` Muchun Song [this message]
2022-06-21 7:39 ` David Hildenbrand
2022-06-22 3:40 ` Oscar Salvador
2022-06-21 20:53 ` [PATCH v5 0/2] " Andrew Morton
2022-06-22 3:31 ` Muchun Song
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=YrCA9JIet7RulSPo@FVFYT0MHHV2J.usts.net \
--to=songmuchun@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=david@redhat.com \
--cc=duanxiongchun@bytedance.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=osalvador@suse.de \
--cc=paulmck@kernel.org \
--cc=smuchun@gmail.com \
/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