Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp1425090imk; Mon, 4 Jul 2022 02:49:49 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tz7I3mrlMhUPw48iUbZVCGH4wPOr4w78EILCIxvjQSXMreS06LYOTP2Rh32159IdZ9ao+5 X-Received: by 2002:a17:907:75c1:b0:72a:430d:b512 with SMTP id jl1-20020a17090775c100b0072a430db512mr26316592ejc.146.1656928189639; Mon, 04 Jul 2022 02:49:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656928189; cv=none; d=google.com; s=arc-20160816; b=zko3Sf0lRZ5qBp1rAzNLDK+y6Df4vT709s4a16Xjbqpy+ns38mnkIOgaBBPLylR3wo wsCcfUZc8rZcBZmDXPOI9DbNM/B+IfKog694UTl60zPZSztjbJENfjn5gfjPrabRqFs3 80GWqkhCwV47Og21irKTr1MdgbiOkAnOtxEeCnZ+n8Aw1XBVgZd/D6BQ5svYid3z5N2A X0fAXwz1GtJNSPfRbAJ8rj8DLHdOejoqylxxB+KReSNbue3YDWTzgUHJ6DgLAQcQtU64 4CwLRFmRqzID8AeJnngutNT7lDu2DHfseg7ioX3evKthPKqEXROSuUFBR6FtjkJQ3GwD tR5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=su/qiV0/gOnZqwxpGnPDGdT+IiavqxstQhE22A3uoM0=; b=LeQWf/rc3O76ydSpL/iSmvLdHuFWNeB8fUDwbeNcgZXIiHXDOwON99sMoNhz3Hgc/i cRd9A7a6ebVairmbLgsgHaE5DG1Wm98pqu2S3p/ZqbbUObVnGoMl0iCZ3aS4QHjQlqe6 h2uyIBWq1lCdlmvPenJ8IC5jhKEj2+SsHimNzt3xCkApXJdRKnUMT+HtglW50hjrcemK hUcKMTyQNg5k8LhQ8ReYguMilNDSOmfz4ogw8OBcqbtxEHcy31n3MpjNsZepqxzoDCms oq/xsff6dOBI8RqA/660C1/r8UPz1DtVgvkHCGY08fSymJ9CYoiXXFj10J8Gu+za4gQw b2Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tPgH5Mvi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go18-20020a1709070d9200b00728ef889ae7si13797209ejc.829.2022.07.04.02.49.24; Mon, 04 Jul 2022 02:49:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tPgH5Mvi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231833AbiGDJ1R (ORCPT + 99 others); Mon, 4 Jul 2022 05:27:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231339AbiGDJ1I (ORCPT ); Mon, 4 Jul 2022 05:27:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EAF5B874; Mon, 4 Jul 2022 02:27:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 09DC6613F9; Mon, 4 Jul 2022 09:27:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9AECC3411E; Mon, 4 Jul 2022 09:27:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656926826; bh=hH3spFHQdwa+gBgAQj1zYN9yiX7A+GyWbQNkSUNtmqE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tPgH5MviYy9ljQGlgk2YGIiFgQ8NkEu/yXE76JqtS8NDw6dJRXw0NALaVYioW0QRv sO7GRsJSFEvCL37fwZTrUV1KRtLzjUd1qcAjSbNHezIvUyPFhpNOdR7R65xhA1Bzna xdh4ctJKv6zSFXk1dw18xyL9kStkntDYzzEnIPp/Gw4DO5bMUPhipv3D099StIfaYg op2O9GNXgwghxWt0W6k1nPUVzGeYaifFqQdn7NcCRy5D7iijvfoOasn133QL4+KyD7 qdeWKZuMu8Hl5DMVRekLenYO0rMF8Cmq8lY0fT/jDIcYYM8DJiIfO1RJD7jq2fzpI6 aGn3RxHukrnKg== Date: Mon, 4 Jul 2022 10:26:58 +0100 From: Will Deacon To: Huacai Chen Cc: Arnd Bergmann , Huacai Chen , Thomas Bogendoerfer , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Catalin Marinas , loongarch@lists.linux.dev, linux-arch@vger.kernel.org, Xuefeng Li , Guo Ren , Xuerui Wang , Jiaxun Yang , Andrew Morton , linux-mm@kvack.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Feiyang Chen Subject: Re: [PATCH V3 3/4] mm/sparse-vmemmap: Generalise vmemmap_populate_hugepages() Message-ID: <20220704092658.GA31220@willie-the-truck> References: <20220702080021.1167190-1-chenhuacai@loongson.cn> <20220702080021.1167190-4-chenhuacai@loongson.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220702080021.1167190-4-chenhuacai@loongson.cn> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 02, 2022 at 04:00:20PM +0800, Huacai Chen wrote: > From: Feiyang Chen > > Generalise vmemmap_populate_hugepages() so ARM64 & X86 & LoongArch can > share its implementation. > > Signed-off-by: Feiyang Chen > Signed-off-by: Huacai Chen > --- > arch/arm64/mm/mmu.c | 53 ++++++----------------- > arch/loongarch/mm/init.c | 63 ++++++++------------------- > arch/x86/mm/init_64.c | 92 ++++++++++++++-------------------------- > include/linux/mm.h | 6 +++ > mm/sparse-vmemmap.c | 54 +++++++++++++++++++++++ > 5 files changed, 124 insertions(+), 144 deletions(-) > > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index 626ec32873c6..b080a65c719d 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -1158,49 +1158,24 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node, > return vmemmap_populate_basepages(start, end, node, altmap); > } > #else /* !ARM64_KERNEL_USES_PMD_MAPS */ > +void __meminit vmemmap_set_pmd(pmd_t *pmd, void *p, int node, > + unsigned long addr, unsigned long next) > +{ > + pmd_set_huge(pmd, __pa(p), __pgprot(PROT_SECT_NORMAL)); > +} > + > +int __meminit vmemmap_check_pmd(pmd_t *pmd, int node, unsigned long addr, > + unsigned long next) > +{ > + vmemmap_verify((pte_t *)pmd, node, addr, next); > + return 1; > +} nit, but please can you use 'pmdp' instead of 'pmd' for the pointers? We're pretty consistent elsewhere for arch/arm64 and it makes the READ_ONCE() usage easier to follow once functions end up loading the entry. Thanks, Will