From: Anshuman Khandual <anshuman.khandual@arm.com>
To: Catalin Marinas <catalin.marinas@arm.com>,
Zhenhua Huang <quic_zhenhuah@quicinc.com>
Cc: will@kernel.org, ardb@kernel.org, ryan.roberts@arm.com,
mark.rutland@arm.com, joey.gouly@arm.com,
dave.hansen@linux.intel.com, akpm@linux-foundation.org,
chenfeiyang@loongson.cn, chenhuacai@kernel.org,
linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] arm64: mm: implement vmemmap_check_pmd for arm64
Date: Fri, 27 Dec 2024 08:27:18 +0530 [thread overview]
Message-ID: <39a85800-47c5-4529-906d-5a40e58ce136@arm.com> (raw)
In-Reply-To: <Z2W5Bs0bZANI6NKv@arm.com>
On 12/21/24 00:05, Catalin Marinas wrote:
> On Mon, Dec 09, 2024 at 05:42:27PM +0800, Zhenhua Huang wrote:
>> vmemmap_check_pmd() is used to determine if needs to populate to base
>> pages. Implement it for arm64 arch.
>>
>> Fixes: 2045a3b8911b ("mm/sparse-vmemmap: generalise vmemmap_populate_hugepages()")
>> Signed-off-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>
>> ---
>> arch/arm64/mm/mmu.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
>> index fd59ee44960e..41c7978a92be 100644
>> --- a/arch/arm64/mm/mmu.c
>> +++ b/arch/arm64/mm/mmu.c
>> @@ -1169,7 +1169,8 @@ int __meminit vmemmap_check_pmd(pmd_t *pmdp, int node,
>> unsigned long addr, unsigned long next)
>> {
>> vmemmap_verify((pte_t *)pmdp, node, addr, next);
>> - return 1;
>> +
>> + return pmd_sect(*pmdp);
Please change this as pmd_sect(READ_ONCE(*pmdp)) instead.
>> }
>>
>> int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
>
> Don't we need this patch only if we implement the first one? Please fold
> it into the other patch.
Seems like these patches might not be related.
While creating huge page based vmemmap mapping during vmemmap_populate_hugepages(),
vmemmap_check_pmd() validates if a populated (i.e pmd_none) PMD already represents
a huge mapping and can be skipped there after.
Current implementation for vmemmap_check_pmd() on arm64, unconditionally returns 1
thus asserting that the given populated PMD entry is a huge one indeed, which will
be the case unless something is wrong. vmemmap_verify() only ensures that the node
where the pfn is allocated from is local.
int __meminit vmemmap_check_pmd(pmd_t *pmdp, int node,
unsigned long addr, unsigned long next)
{
vmemmap_verify((pte_t *)pmdp, node, addr, next);
return 1;
}
However it does not really check the entry to be a section mapping which it should.
Returning pmd_sect(READ_ONCE(*pmdp)) is the right thing, which should have been the
case from the beginning when vmemmap_check_pmd() was added. I guess because arm64's
original vmemmap_populate() checked only for vmemmap_verify() as well. So probably
this does not need a "Fixes: " tag.
next prev parent reply other threads:[~2024-12-27 2:57 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 9:42 [PATCH v2 0/2] Fix subsection vmemmap_populate logic Zhenhua Huang
2024-12-09 9:42 ` [PATCH v2 1/2] arm64: mm: vmemmap populate to page level if not section aligned Zhenhua Huang
2024-12-20 18:30 ` Catalin Marinas
2024-12-24 9:32 ` Zhenhua Huang
2024-12-24 14:09 ` Catalin Marinas
2024-12-25 9:59 ` Zhenhua Huang
2024-12-27 7:49 ` Anshuman Khandual
2024-12-30 7:48 ` Zhenhua Huang
2024-12-31 5:52 ` Zhenhua Huang
2025-01-02 3:16 ` Anshuman Khandual
2025-01-02 9:07 ` Zhenhua Huang
2025-01-02 3:51 ` Anshuman Khandual
2025-01-02 9:13 ` Zhenhua Huang
2025-01-02 18:58 ` Catalin Marinas
2025-01-03 2:01 ` Zhenhua Huang
2024-12-09 9:42 ` [PATCH v2 2/2] arm64: mm: implement vmemmap_check_pmd for arm64 Zhenhua Huang
2024-12-20 18:35 ` Catalin Marinas
2024-12-27 2:57 ` Anshuman Khandual [this message]
2024-12-30 7:48 ` Zhenhua Huang
2024-12-31 6:59 ` Anshuman Khandual
2024-12-31 7:18 ` Zhenhua Huang
2025-01-02 18:12 ` Catalin Marinas
2025-01-03 2:43 ` Zhenhua Huang
2025-01-03 17:58 ` Catalin Marinas
2024-12-17 1:47 ` [PATCH v2 0/2] Fix subsection vmemmap_populate logic Zhenhua Huang
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=39a85800-47c5-4529-906d-5a40e58ce136@arm.com \
--to=anshuman.khandual@arm.com \
--cc=akpm@linux-foundation.org \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=chenfeiyang@loongson.cn \
--cc=chenhuacai@kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=joey.gouly@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mark.rutland@arm.com \
--cc=quic_zhenhuah@quicinc.com \
--cc=ryan.roberts@arm.com \
--cc=will@kernel.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