From patchwork Thu Oct 10 03:50:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bibo mao X-Patchwork-Id: 13829443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68EB6CEDDBB for ; Thu, 10 Oct 2024 03:50:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C40626B0085; Wed, 9 Oct 2024 23:50:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC8E56B0088; Wed, 9 Oct 2024 23:50:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A69A06B0089; Wed, 9 Oct 2024 23:50:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 889C76B0085 for ; Wed, 9 Oct 2024 23:50:56 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 41B05121865 for ; Thu, 10 Oct 2024 03:50:53 +0000 (UTC) X-FDA: 82656316470.07.BB27BE9 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by imf16.hostedemail.com (Postfix) with ESMTP id 72B79180008 for ; Thu, 10 Oct 2024 03:50:52 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf16.hostedemail.com: domain of maobibo@loongson.cn designates 114.242.206.163 as permitted sender) smtp.mailfrom=maobibo@loongson.cn ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728532118; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ojkToVyZt+6AV6/9LXFFZWf07ErRU8/WaYD6ufYZxvY=; b=ANIO0Z1IW3PW9jLbdtODAOLNUb5Dddj7NnLZoEC6P75itxeuRodUAzeO2jOmsrbtsoQjpi AjGaXs+GdCIYvLLM9T32LkAopUp6Zq1PuIT+WL2z1feFydi4Q85Yvo+G32R4Fk3mSAwfyV e2uTKk80U/d5FeMEKte7WOQbHnwu0y8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728532118; a=rsa-sha256; cv=none; b=vkk4zR7P3k3df2Qq6yt5J2PO6llKFIMJM17JEHG7HS/1yNVtdWDUqTYLn3wsWsa0YwIUvf HNfNGVCMKsSoTfOwQ4Tg8Sgy7CRKagPaEzcR8vVnVawu6USxZEED2bA3ZvDGSvtL4ONwWF EmWtKAaBUh234vbp4ZBTSkVIg8J5Y6M= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf16.hostedemail.com: domain of maobibo@loongson.cn designates 114.242.206.163 as permitted sender) smtp.mailfrom=maobibo@loongson.cn Received: from loongson.cn (unknown [10.2.5.213]) by gateway (Coremail) with SMTP id _____8AxCGoaTwdny7sRAA--.25768S3; Thu, 10 Oct 2024 11:50:50 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.213]) by front1 (Coremail) with SMTP id qMiowMDx7tUZTwdnFP8hAA--.52915S4; Thu, 10 Oct 2024 11:50:50 +0800 (CST) From: Bibo Mao To: Huacai Chen , Andrey Ryabinin , Andrew Morton Cc: David Hildenbrand , Barry Song , 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 Message-Id: <20241010035048.3422527-3-maobibo@loongson.cn> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20241010035048.3422527-1-maobibo@loongson.cn> References: <20241010035048.3422527-1-maobibo@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: qMiowMDx7tUZTwdnFP8hAA--.52915S4 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== X-Rspamd-Queue-Id: 72B79180008 X-Stat-Signature: nikabxnp5zohm4wx7mumnqqdegizbgqm X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1728532252-130832 X-HE-Meta: U2FsdGVkX1/BoxLoKLvwilMuhy937IeemzOy94z3S62/A04cKkEnEnB3PAL1x2GmMGjKTRD1FArE5RPbFcL9s9X1wY+Zs83IjEfFoGZD2+TkysoZ4iGL3IeR6dCzRMSZ4atdwhSGYCTcn6xlnXQvW7hGIkTcPvlsbQANxM/C+1vFOJqj/bvwEgFT3Uhn3KYogMxCb6+fhm1mO766J75tziyFP2naxN7U8jFVYUkCT9FlY5psdVxEVmq/1G4oirP9QOMadp5/a23w7l28uRldZUeiJhNGz1x2ebqc+tufq6GHysyUyP9lhWHJfz2CMJyhz/jjWjFujVLcI4PuN/K9bF8Kj1PW9DEXKFR+0d7v/C7gt/jWxbreN/u55WLuWNyhuuIwS5Z7tci2dPkRGzYBDmH6xc7lu06mayjif1RgjoXsERvMFnRDMo60Cum61Y1Xd4RKdMnM5b729uo9ENYxkT/JUt2OqadhT+j2QVfjEzk/GU4Gumb75ggiBregw0iKPiOiiY6kz+xsU4YiKtrpgiqShFBlvaQ/4gcEGw0OtxP/34zpceCRzIjRiHLSb3Yb+Ia+4OxCbxjUoFwV8B/KcquounBZSwf933hucKwaIUenFGSiiy3IHYnyeOagV4vMiNP0OpfCiOxrO/tXkT07xMt0smulM4eIhWGIovgGQUp7WsnZUVFpYoXYo4x+XBP28fSZvDQGajD5f4r/j0gex2O5AgcpSDxsObEBreMydhgRMZWF3tzKpFMoTxhufDPhGOA2Kj/v2nkafmzcGlRc66/JVOGPS89dPc8PkKBVp2favknsQyiGHRbfZRAvTrUc3AcmCbam++nMmtoXDiBU5FQNuwXZ+wZJ4hQx7/C53zEXdJAw5ltvY5ng4hXSf8HYedpwy+d+IQTSIcOVM/zypujoeSADLq5vYiAq/YgG/PBYMtAXBPsNSf+h+GnX1HdTayQcu06dXxJ+q02iXN3 xmaxM+nh IwCzosGdTJF2G/pe8X2qJgBlsmpv55+yVp+itGJUmgJrdPS1tD5eyyPezu044am4dSIJBnfjAUlQEqX62xn7t7fDq8m6O8N/7amyipnZAnwxqqmbHJ9G26nYvfQpsVN8od6RqfNnd3dukjIJN3yIiz/kMvA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 --- 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;