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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 E8640C433ED for ; Thu, 20 May 2021 11:59:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9050560FEF for ; Thu, 20 May 2021 11:59:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9050560FEF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 31DF98E0005; Thu, 20 May 2021 07:59:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2CC4B6B00C6; Thu, 20 May 2021 07:59:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 16D818E0005; Thu, 20 May 2021 07:59:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0155.hostedemail.com [216.40.44.155]) by kanga.kvack.org (Postfix) with ESMTP id D8D5B6B00C5 for ; Thu, 20 May 2021 07:59:55 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7D029181AC9CB for ; Thu, 20 May 2021 11:59:55 +0000 (UTC) X-FDA: 78161465550.06.2B51B3F Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf29.hostedemail.com (Postfix) with ESMTP id 4D42C403 for ; Thu, 20 May 2021 11:59:52 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 25615101E; Thu, 20 May 2021 04:59:54 -0700 (PDT) Received: from [10.163.80.140] (unknown [10.163.80.140]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D8D143F73D; Thu, 20 May 2021 04:59:49 -0700 (PDT) Subject: Re: [External] Re: [PATCH] arm64: mm: hugetlb: add support for free vmemmap pages of HugeTLB To: Muchun Song 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 References: <20210518091826.36937-1-songmuchun@bytedance.com> <1b9d008a-7544-cc85-5c2f-532b984eb5b5@arm.com> From: Anshuman Khandual Message-ID: Date: Thu, 20 May 2021 17:30:34 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4D42C403 Authentication-Results: imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com X-Rspamd-Server: rspam03 X-Stat-Signature: mshw4zm13b8p41xzgq18w34qkod7eyby X-HE-Tag: 1621511992-659493 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: On 5/19/21 6:19 PM, Muchun Song wrote: > 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. The worst case scenario for ptdump would be an wrong information being dumped. But as mentioned earlier, this must be protected against memory hot remove operation which could free up entries for vmemmap areas in the kernel page table.