Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp336557iog; Thu, 30 Jun 2022 01:36:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ubMaO1gunokWGCHsIlFnc7KUdrTBt3FavQx1JeyE4Ul+VX/KmnYeowTVGofwMMq+vxNTI2 X-Received: by 2002:a17:90b:2496:b0:1ef:a94:7048 with SMTP id nt22-20020a17090b249600b001ef0a947048mr8806731pjb.244.1656578218492; Thu, 30 Jun 2022 01:36:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656578218; cv=none; d=google.com; s=arc-20160816; b=oIHzsl/P2cP+xmUII0Fka9tEB37MBx/O2DKtdrD4JcZ1FKS4vCLZjbvQK+Yy+JITyq L6Y0QeS7wk8Mml7Bsu+WC0c3BpDFO8Gc5XdFax/qXCXE+9nohu5b71mbKS3HcvBWzCE3 DFrsa3oUvLJLc8Dp3ArEOLpy2tihvPeGk0d1uVpx1oMVUIKWyF/ZkXH2JR4Z01FQXG09 xFx/TKIuRA9s2yf7nx2IhjK8ArZl7Tju/FIPrEKUcFbq1rvypDwTobwffX7g+ujm0RfB Hhx5NYYeClqHfp8WJ5iCTQVlW/EC+3dKHiAMlD09wH3g8I+y+2bVwXRFiRdj0PiPh4vZ rWIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ydbbzmyvSbnE+JeMSUHT6PsXCELrpgO0M6vDiILnz+E=; b=gjxNK1lmFq+jo8en3bHs3MYFXqXOyhuSkvKeirhlulJgL4lfYSt2dRqAdzE+j1OyZQ zWJqPbm20c3nsMmSlMkqpFI9lpXUxzgGcnfGaV/5bAgvGdPy7WJ8XKKLwxzOGCD9+ZGK YMzuZV+urswk+hhgGmh2GvD5qnIreygNWVJIX7n10wY1VxZwrgDHGgjNGHRWC0abD4XS HF+IpJkXWmcO810LWMofybmpEZ0oiEXA8PiWn1GMiHQxHmS5nFmu5PpyW/8+ZK9apbD0 2MOk2Rtrb0QTID7R/NqeRIKpm7Ff0KH4ZxNrWjYSX3dk7aBvjfveiD17uL12gDXEdOnL bEaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=B7CPMIbh; 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 w9-20020a634909000000b0040db5db7e7csi8387180pga.546.2022.06.30.01.36.46; Thu, 30 Jun 2022 01:36:58 -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=B7CPMIbh; 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 S233613AbiF3I2T (ORCPT + 99 others); Thu, 30 Jun 2022 04:28:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233956AbiF3I2N (ORCPT ); Thu, 30 Jun 2022 04:28:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7BFBBE3; Thu, 30 Jun 2022 01:28:08 -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 09F7761E54; Thu, 30 Jun 2022 08:28:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BB08C341D7; Thu, 30 Jun 2022 08:28:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656577687; bh=SkqClHc7drj1TyPDl23yksWfycVYMTWrSPIUHoyfEwE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=B7CPMIbhC1C2mpkc3aoWjdmyrIVGqtmC9zFMsPeE1twNFdxgdBwruNn9qlvq8jzmX b03vb4SBq2jZqMvhnz6275h/IvCA4d/VfOrPuNA5rzaHdo29eitnlBN1wIs7Nmd0CR t0Gkex5Mr/Gtcew15u8uW4194ALBx15jBKU/1NqqQxEExH85aA42xfX63VYP+ugC+i j0K069hCdHJbRgrll1Czxbqz5fUNEfMB0Punsrjm2p8Uo5vaZsWTT4nSiLhSEbYU5G ZQnWhtgOV9XEzpRWWmolnlYDZNX7CKsEpxY6zkvLG69hHnu/NQy3A4yHfbFmEPM4m7 Qsg1KIf2WNBPQ== Received: by mail-vk1-f175.google.com with SMTP id az35so8659846vkb.0; Thu, 30 Jun 2022 01:28:07 -0700 (PDT) X-Gm-Message-State: AJIora+1twvNlHDCHf/sbNpTnBj1PdVCGEnQ2lKvVOzOmkUCAutAaQCk 2Z7uy5poZ+TEv8OPUgbB3Lg8Do7B+TqwBNf3uBw= X-Received: by 2002:a1f:2a86:0:b0:370:8ff3:d5f with SMTP id q128-20020a1f2a86000000b003708ff30d5fmr3791575vkq.35.1656577686160; Thu, 30 Jun 2022 01:28:06 -0700 (PDT) MIME-Version: 1.0 References: <20220630043237.2059576-1-chenhuacai@loongson.cn> <20220630043237.2059576-4-chenhuacai@loongson.cn> In-Reply-To: From: Huacai Chen Date: Thu, 30 Jun 2022 16:27:53 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V2 3/4] mm/sparse-vmemmap: Generalise vmemmap_populate_hugepages() To: Arnd Bergmann Cc: Huacai Chen , Thomas Bogendoerfer , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Catalin Marinas , Will Deacon , loongarch@lists.linux.dev, linux-arch , Xuefeng Li , Guo Ren , Xuerui Wang , Jiaxun Yang , Andrew Morton , Linux-MM , "open list:BROADCOM NVRAM DRIVER" , Linux Kernel Mailing List , Linux ARM , Feiyang Chen Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.5 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 Hi, Arnd, On Thu, Jun 30, 2022 at 2:05 PM Arnd Bergmann wrote: > > On Thu, Jun 30, 2022 at 6:32 AM Huacai Chen wrote: > > > > From: Feiyang Chen > > > > Generalise vmemmap_populate_hugepages() so ARM64 & X86 & LoongArch can > > share its implementation. > > Sharing this function is good, thanks for consolidating this > > > Signed-off-by: Huacai Chen > > Signed-off-by: Feiyang Chen > > The Signed-off-by lines are in the wrong order, it should start with the author > and end with the final submitter. OK, I will change the order. > > > index 33e2a1ceee72..6f2e40bb695d 100644 > > --- a/mm/sparse-vmemmap.c > > +++ b/mm/sparse-vmemmap.c > > @@ -686,6 +686,60 @@ int __meminit vmemmap_populate_basepages(unsigned long start, unsigned long end, > > return vmemmap_populate_range(start, end, node, altmap, NULL); > > } > > > > +void __weak __meminit vmemmap_set_pmd(pmd_t *pmd, void *p, int node, > > + unsigned long addr, unsigned long next) > > +{ > > +} > > + > > +int __weak __meminit vmemmap_check_pmd(pmd_t *pmd, int node, unsigned long addr, > > + unsigned long next) > > +{ > > + return 0; > > +} > > + > > I think inline functions would be better here, both for compiler optimization > and to make it easier to track the code flow. The normal way we do these > in architecture specific headers is to override the functions by defining a > macro of the same name. In my opinion, weak functions are suitable for overriding if they are only used in a single .c file (this case). If we don't use weak functions, this series needs as many as 4 #ifdefs, for pud_init(), pmd_init(), vmemmap_set_pmd() and vmemmap_check_pmd() respectively, which increase the difficulty of maintain (just my own opinion, maybe not a objective fact). Huacai > > > Arnd