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 X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CAC6C433ED for ; Wed, 19 May 2021 13:13:10 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 74EEA6135C for ; Wed, 19 May 2021 13:13:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74EEA6135C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=j4ubzLuI+0X5K2tly1+8Sm4wV0dAdGyb//aUwl+0dgA=; b=a1Re9LVQSF5/cAMRD2gvY5ozI G0kFeNWGFVeAnsX3QEex5N+zaxbitmf3CNUlYQ+EYk5A2hKYLOcoPaqYk7nwdHdV0H9uu3a4EPA7e YZ9LiEoGeCyxgYeoXDp1SIQ+JpXMnP9Lej1mIvdSW7kPMJGOxwwlvcPyeje0E2CnUE9n5NLM3CLeA 0FJgvrb3Mrx2UBlD7/7TWX3Tc3FRN/0378EDM5tva6lv3qj3VJyPiZ8l2zpo403D6Sp0BRfEZyFe8 slW/u5eiA6EfGp16yMljs3JMswgUV7A8ImZj9drSweJCqu7KWRc170NbajA+ZL2lybgd8jSJzmqyE LoLle0Esg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljLyS-0043VK-H5; Wed, 19 May 2021 13:10:56 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljLdv-003xyg-Bo for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 12:49:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=tvJutpwC6OgwGmGHfHy5EWnjg1FWF0WzmnPf7pobyMA=; b=umVjYLAWMRgl3XAIeFS1p/yKx9 8oHlqJUCXNHlrCuO2Ei33mM08f4nrs5uK5evnYnOTG32440JX+7KqDqiJZm0Q1BF91wSV/gcOQ8JP NduYRl9KcscR2W+W/zv87I3lrM0keGvz1DBHVvf7HQppBELJkbTXstWUXp0uPepX0+CyW8NDFbKJ3 Xy1CwxKash02vELHFDVbWldaE1ResF8S87v/lT2iUpqJmC/rDjiyt7iVmUrTtVlemMHFzAsd3e+NB JLlFrnvxwXxk3hIaiPnEyWcfOM/Kyu40fWTTWZ1Yh2YMDVxmFxjj34oLbMyE6+Lsl9gFldbXxbOpu Le8Z9dkg==; Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljLdr-00FTIO-NB for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 12:49:41 +0000 Received: by mail-pg1-x532.google.com with SMTP id m190so9389534pga.2 for ; Wed, 19 May 2021 05:49:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tvJutpwC6OgwGmGHfHy5EWnjg1FWF0WzmnPf7pobyMA=; b=QufUefRIlU44FY39RoXA9yMQtgsz4rayOLXiUTmjXOG5uGd77aWagMHwUBMDX+RtIN C2eCS6q4KG2YNrXHZv2Pu3m5g0ERToP8QbxEtaMlDRU2gEuUyeaiEcG/3sYDxLt+ZP6c hI2RBFsfGa+wL0IVG2OBtugJ/vQM/eQ+t2eVJUl6I1en2K9CiwxU/KwuY6JLlYiX5Dn1 JIFUtRf9S5UnpgNvVQP8HO3nDkbsURG+773vRxvuHzeNCnNc/OVNX06PzOFw7Mk0WPOS 4bAebUHu9NpE8sAijFDlO/7hDQ315Oa9hGah43zz4zDls/1VWfSiwywpAKAe13SMUQSo JSgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tvJutpwC6OgwGmGHfHy5EWnjg1FWF0WzmnPf7pobyMA=; b=X/L4Fy3MsivTR6+1c7WVI3K4UT8xiE/bHU6/Tnrqqtk5SnfnI336lVNDVIjuReQQ1F WJq7QV4QFM/ujEhXQswnlswQaCfVbY7LQWz21jvmXQxwvXkIzVXd5x/d09948I/2hyLa JqRp5o5SfKuPJXjltyOyUh1ZY6Tw5pH3mSi98eEV5qF2C4Hc4tnLeLx7nYV6/kUNth9n tR6dauNC5clBdljqcRwA2mCoYwNBi0Dgwf9ur55d3vlbpvxVAwz2kjGq/IzSIkCPMNAU b9qqYz8WIG+Rh/ZkvjnjxuyFYyAjwB9tVvXOM209pCaO8e2rqUmntuekhM9o/nXu0Ngb PCIQ== X-Gm-Message-State: AOAM532aWFRHN9MelGNl+PaO/xQgEgBz5mKVyMFB+hQ6Mgt0JDVPLkX6 erA2VSZsjXhfGGnDjwJ0ngdc8A2qbwvWlPSneP6abQ== X-Google-Smtp-Source: ABdhPJyZx4agyuvNquMytHMJMDBzKLpAAvLI6jhho/A1kk6p6EGRPN0rxd2JSuQn+Or+HTp5dG1IPPv7arMrUucHTSI= X-Received: by 2002:a63:1953:: with SMTP id 19mr10638032pgz.273.1621428577422; Wed, 19 May 2021 05:49:37 -0700 (PDT) MIME-Version: 1.0 References: <20210518091826.36937-1-songmuchun@bytedance.com> <1b9d008a-7544-cc85-5c2f-532b984eb5b5@arm.com> In-Reply-To: <1b9d008a-7544-cc85-5c2f-532b984eb5b5@arm.com> From: Muchun Song Date: Wed, 19 May 2021 20:49:02 +0800 Message-ID: Subject: Re: [External] Re: [PATCH] arm64: mm: hugetlb: add support for free vmemmap pages of HugeTLB To: Anshuman Khandual Cc: Will Deacon , Andrew Morton , David Hildenbrand , "Bodeddula, Balasubramaniam" , Oscar Salvador , Mike Kravetz , David Rientjes , linux-arm-kernel@lists.infradead.org, LKML , Linux Memory Management List , Xiongchun duan , fam.zheng@bytedance.com, zhengqi.arch@bytedance.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_054939_829957_04D92C2F X-CRM114-Status: GOOD ( 29.43 ) 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 Wed, May 19, 2021 at 7:44 PM Anshuman Khandual wrote: > On 5/18/21 2:48 PM, Muchun Song wrote: > > The preparation of supporting freeing vmemmap associated with each > > HugeTLB page is ready, so we can support this feature for arm64. > > > > Signed-off-by: Muchun Song > > --- > > arch/arm64/mm/mmu.c | 5 +++++ > > fs/Kconfig | 2 +- > > 2 files changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > > index 5d37e461c41f..967b01ce468d 100644 > > --- a/arch/arm64/mm/mmu.c > > +++ b/arch/arm64/mm/mmu.c > > @@ -23,6 +23,7 @@ > > #include > > #include > > #include > > +#include > > > > #include > > #include > > @@ -1134,6 +1135,10 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node, > > pmd_t *pmdp; > > > > WARN_ON((start < VMEMMAP_START) || (end > VMEMMAP_END)); > > + > > + if (is_hugetlb_free_vmemmap_enabled() && !altmap) > > + return vmemmap_populate_basepages(start, end, node, altmap); > > Not considering the fact that this will force the kernel to have only > base page size mapping for vmemmap (unless altmap is also requested) > which might reduce the performance, it also enables vmemmap mapping to > be teared down or build up at runtime which could potentially collide > with other kernel page table walkers like ptdump or memory hotremove > operation ! How those possible collisions are protected right now ? For the ptdump, there seems no problem. The change of pte seems not to affect the ptdump unless I miss something. > > Does not this vmemmap operation increase latency for HugeTLB usage ? > Should not this runtime enablement also take into account some other > qualifying information apart from potential memory save from struct > page areas. Just wondering. The disadvantage is we add a PTE level mapping for vmemmap pages, from this point of view, the latency will be increased. But There's an additional benefit which is that page (un)pinners will see an improvement, because there are fewer vmemmap pages and thus the tail/head pages are staying in cache more often. >From this point of view, the latency will be decreased. So if the user cares about the memory usage of the struct page, he can enable this feature via cmdline when boot. As David said "That's one of the reasons why it explicitly has to be enabled by an admin". > > > + > > do { > > next = pmd_addr_end(addr, end); > > > > diff --git a/fs/Kconfig b/fs/Kconfig > > index 6ce6fdac00a3..02c2d3bf1cb8 100644 > > --- a/fs/Kconfig > > +++ b/fs/Kconfig > > @@ -242,7 +242,7 @@ config HUGETLB_PAGE > > > > config HUGETLB_PAGE_FREE_VMEMMAP > > def_bool HUGETLB_PAGE > > - depends on X86_64 > > + depends on X86_64 || ARM64 > > depends on SPARSEMEM_VMEMMAP > > > > config MEMFD_CREATE > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel