From: Bibo Mao <maobibo@loongson.cn>
To: Huacai Chen <chenhuacai@kernel.org>,
Andrey Ryabinin <ryabinin.a.a@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@redhat.com>,
Barry Song <baohua@kernel.org>,
loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
kasan-dev@googlegroups.com, linux-mm@kvack.org
Subject: [PATCH 2/4] mm/sparse-vmemmap: set pte_init when vmemmap is created
Date: Thu, 10 Oct 2024 11:50:46 +0800 [thread overview]
Message-ID: <20241010035048.3422527-3-maobibo@loongson.cn> (raw)
In-Reply-To: <20241010035048.3422527-1-maobibo@loongson.cn>
Like pmd_init(), a weak function kernel_pte_init() is added and it
is only effective on LoongArch system. When pte table is created for
vmemmap kernel space, function kernel_pte_init() is called here.
It has no any effective on other architectures.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
mm/sparse-vmemmap.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
index edcc7a6b0f6f..c0388b2e959d 100644
--- a/mm/sparse-vmemmap.c
+++ b/mm/sparse-vmemmap.c
@@ -184,6 +184,10 @@ static void * __meminit vmemmap_alloc_block_zero(unsigned long size, int node)
return p;
}
+void __weak __meminit kernel_pte_init(void *addr)
+{
+}
+
pmd_t * __meminit vmemmap_pmd_populate(pud_t *pud, unsigned long addr, int node)
{
pmd_t *pmd = pmd_offset(pud, addr);
@@ -191,6 +195,7 @@ pmd_t * __meminit vmemmap_pmd_populate(pud_t *pud, unsigned long addr, int node)
void *p = vmemmap_alloc_block_zero(PAGE_SIZE, node);
if (!p)
return NULL;
+ kernel_pte_init(p);
pmd_populate_kernel(&init_mm, pmd, p);
}
return pmd;
--
2.39.3
next prev parent reply other threads:[~2024-10-10 3:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-10 3:50 [PATCH 0/4] LoongArch: Fix vmalloc test issue Bibo Mao
2024-10-10 3:50 ` [PATCH 1/4] LoongArch: Set pte entry with PAGE_GLOBAL for kernel space Bibo Mao
2024-10-12 2:15 ` Huacai Chen
2024-10-12 2:40 ` maobibo
2024-10-10 3:50 ` Bibo Mao [this message]
2024-10-11 4:42 ` [PATCH 2/4] mm/sparse-vmemmap: set pte_init when vmemmap is created kernel test robot
2024-10-11 4:42 ` kernel test robot
2024-10-12 2:17 ` Huacai Chen
2024-10-10 3:50 ` [PATCH 3/4] LoongArch: Add barrier between set_pte and memory access Bibo Mao
2024-10-12 2:16 ` Huacai Chen
2024-10-12 2:48 ` maobibo
2024-10-10 3:50 ` [PATCH 4/4] LoongArch: Use atomic operation with set_pte and pte_clear function Bibo Mao
2024-10-12 2:16 ` Huacai Chen
2024-10-12 2:51 ` maobibo
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=20241010035048.3422527-3-maobibo@loongson.cn \
--to=maobibo@loongson.cn \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=david@redhat.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=loongarch@lists.linux.dev \
--cc=ryabinin.a.a@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