From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 76DC2C43334 for ; Wed, 6 Jul 2022 16:19:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BSRZVN0uauGxzpkxQQZu16oQ2RGMEt5SGM0tGzFF3tM=; b=oh9PLNXFh9vmN/ M45+qJ1F1PMDi9Y3O14rsmKPYwEUNebpaAAp06e5VGUHU7oAkkcj8kLnHndUd22dvaVbzv0u2FZbq iTd+C8/Sxec0/UO4IYni/vLy/kaabAYjBqW6ZEQ1EXJBuC6Amj0I6Dr2RLYTfVBYnXiZoCyMMfQJV IYNuwnyrr1rliiUq30PsLT+V1y2E4fzkbP5wMMBMC9BeMH4NJUZdrJcSiKe8yOFo65+wmAzCAY0AS 9LDnb5oxGyPVspqHYRk9okIbRsZ8GUJNmAuDMb28szbq/C0oNJKPgAd6LIQbshU2AQPYeMO/15+tb l7DaCUw0Xh4LV8iy1XDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o97is-00BHpt-44; Wed, 06 Jul 2022 16:17:54 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o97il-00BHmG-DD for linux-arm-kernel@lists.infradead.org; Wed, 06 Jul 2022 16:17:49 +0000 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 ams.source.kernel.org (Postfix) with ESMTPS id C0DEBB81ADA; Wed, 6 Jul 2022 16:17:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB619C3411C; Wed, 6 Jul 2022 16:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657124264; bh=iUXQ5zeCn7F+rXGeQUyYPSpHic8CAZ/oIMDK22tyFWQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QkkCc5ixzpkLNHQqiXnFn3xxqX9vX6/7pjTO+beEcU7867jQ3yUN0tTRIumCfmw+l XIzzqW2j9D9B4/2+IOEa8BfZuC023EPkTIIlI8emhIRxwe64emyKhFAv8lGeUgTcta zuKnzfTcaivcT4wJUjtBnHQQwH0fDfbzXEQueHNwys3LxQLZfsPGxzK6XZS8PPJ8Yv t7y/jusImrBI66nsaI/PsqnHq6INlZtHblL2bL1nkSyj1G94GXsiCOgO9K8+nIKVlU JtGIYAGbNiHAni7AOCmeuagLTlruDxGIa8OywwwNA7QEwHE9BvWtCfy+YX0GOinCgL usB4BDoSQG4Xg== Date: Wed, 6 Jul 2022 17:17:37 +0100 From: Will Deacon To: Huacai Chen Cc: Dan Williams , Huacai Chen , Arnd Bergmann , Thomas Bogendoerfer , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Catalin Marinas , loongarch@lists.linux.dev, linux-arch , Xuefeng Li , Guo Ren , Xuerui Wang , Jiaxun Yang , Andrew Morton , Linux-MM , "open list:MIPS" , LKML , linux-arm-kernel , Feiyang Chen Subject: Re: [PATCH V4 3/4] mm/sparse-vmemmap: Generalise vmemmap_populate_hugepages() Message-ID: <20220706161736.GC3204@willie-the-truck> References: <20220704112526.2492342-1-chenhuacai@loongson.cn> <20220704112526.2492342-4-chenhuacai@loongson.cn> <20220705092937.GA552@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220706_091747_773675_0D8F02C3 X-CRM114-Status: GOOD ( 27.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jul 05, 2022 at 09:07:59PM +0800, Huacai Chen wrote: > On Tue, Jul 5, 2022 at 5:29 PM Will Deacon wrote: > > On Mon, Jul 04, 2022 at 07:25:25PM +0800, Huacai Chen wrote: > > > diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c > > > 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; > > > +} > > > + > > > +int __meminit vmemmap_populate_hugepages(unsigned long start, unsigned long end, > > > + int node, struct vmem_altmap *altmap) > > > +{ > > > + unsigned long addr; > > > + unsigned long next; > > > + pgd_t *pgd; > > > + p4d_t *p4d; > > > + pud_t *pud; > > > + pmd_t *pmd; > > > + > > > + for (addr = start; addr < end; addr = next) { > > > + next = pmd_addr_end(addr, end); > > > + > > > + pgd = vmemmap_pgd_populate(addr, node); > > > + if (!pgd) > > > + return -ENOMEM; > > > + > > > + p4d = vmemmap_p4d_populate(pgd, addr, node); > > > + if (!p4d) > > > + return -ENOMEM; > > > + > > > + pud = vmemmap_pud_populate(p4d, addr, node); > > > + if (!pud) > > > + return -ENOMEM; > > > + > > > + pmd = pmd_offset(pud, addr); > > > + if (pmd_none(READ_ONCE(*pmd))) { > > > + void *p; > > > + > > > + p = vmemmap_alloc_block_buf(PMD_SIZE, node, altmap); > > > + if (p) { > > > + vmemmap_set_pmd(pmd, p, node, addr, next); > > > + continue; > > > + } else if (altmap) > > > + return -ENOMEM; /* no fallback */ > > > > Why do you return -ENOMEM if 'altmap' here? That seems to be different to > > what we currently have on arm64 and it's not clear to me why we're happy > > with an altmap for the pmd case, but not for the pte case. > The generic version is the same as X86. It seems that ARM64 always > fallback whether there is an altmap, but X86 only fallback in the no > altmap case. I don't know the reason of X86, can Dan Williams give > some explaination? Right, I think we need to understand the new behaviour here before we adopt it on arm64. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel