Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2790703pxb; Sun, 24 Jan 2021 21:11:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJyoP2KX9JSWTj7UtgZPzFFVLTLS4awL3WskegOOE2HzQqvmMnSFkIXRNXL4fZ9YoxqhMpJk X-Received: by 2002:aa7:d4d7:: with SMTP id t23mr1277329edr.321.1611551488867; Sun, 24 Jan 2021 21:11:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611551488; cv=none; d=google.com; s=arc-20160816; b=INkb+1awHlPyntbE04omNRIRoE4UU8nF+c0AAOHTHaOXCNTZi/aNrqn5MbqVQc5CW7 fvLXaWj7vuXwoU8/Yheg32VRc48BMPQ5Fr65k/DthvzsZVm5DubKe4rBFMMaPQsn+f+n cbcsxYfr2mBMx45eeFxqd1rhjf24wgWLfVhAAOOjouX7AFY2V+xVNYNpVhKbUPiHwlb6 D6vmcunodgJSvHJENVXEB57GcA57o5yt4C5pQqeUcC5/e+i6qH81R8GR2yII8FtmFW69 j16PsqhAUUxx5RIldwgQuayA6XrnQ73h0QegjJO9K3KJTZb0Na0FbcbG5SnCu5RqJ8qp Q0Fw== 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=F+LeAZ3S+m2I2AXil2lfLUpMV0pLG8mixzK8f2VmApw=; b=yrUeDh40lI/Mr/7jFhbCVCTLW3h6wPYYuyXd/eovgYrUkFuNT+BINgP80n566uZbzR 7lQux03ysHpw9MAZq4LyyOJsB4N9TUG/RWSmh7t7txv1S7sVY6vCTS/ZKrxUMtkgMmDl b/aOWvqh8TQe/pnHv0lyKPwmkZLpRT1QnjjOCDj2Z4GHFVgLme5nowfx6Rl/b8G8sB3X 0vdt04Gw1SzqITLt5AIuZASc5i1zB55e9eGYm+UVmKMX89Dh/je0trjTXpSsL3/XUNEu CkpUzdsGg+hj5WVlWyMiRZ4vGEdeI7g76rJic1cXohMtK9jasNWPHLWzXst1C8nOuqlp tJoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b="aT/9rd5u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ba2si6673096edb.450.2021.01.24.21.11.05; Sun, 24 Jan 2021 21:11:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b="aT/9rd5u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725272AbhAYFHU (ORCPT + 99 others); Mon, 25 Jan 2021 00:07:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726326AbhAYFHT (ORCPT ); Mon, 25 Jan 2021 00:07:19 -0500 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08395C061574 for ; Sun, 24 Jan 2021 21:06:39 -0800 (PST) Received: by mail-pg1-x52a.google.com with SMTP id v19so8106017pgj.12 for ; Sun, 24 Jan 2021 21:06:39 -0800 (PST) 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=F+LeAZ3S+m2I2AXil2lfLUpMV0pLG8mixzK8f2VmApw=; b=aT/9rd5uVrMHlG0kkM6L/ia4xQjNlHVLs7Yo1N4ieoOC/buPWE6taP44/uPWB4C4QO b4Ru5GuscZDSNJZXEJiW7nIKDqISX1Hch5YioyQWLgtUxJgFCt2wFEINniJJUcfUR+QV E/ALPWnPNg64mfGe/PwI4ngpWA40dORyhsKBNSsjjR9b1/mt1Fw/K9wR2onR0mtBbHck RJixkzeApzAPHTz97k94LyHMkdHedYZwexLkyikaPapRTrmJbYT9NsSRRSJGLsF3eI0v 0ov0SQNfDeV7KWf9t8lB0gTOuX/ObgtvKeMdtzrOT+997Ci7dj4f1Thrw4XhS0sxvZhh r/QQ== 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=F+LeAZ3S+m2I2AXil2lfLUpMV0pLG8mixzK8f2VmApw=; b=i7BMolTumcYPU4TAWV2rClIWknuNcSOg2DXNGC08V1ESq9HO97W0WfDe4LerlVGg70 5xxttUb08ai8k3tLTCc68fsVWYxXvSzWDoCRahYcunQ4PBBO8CxQeDvwNOHLERwuKZfl 7FX8Hg019B6a2T7GiHsHAI6XcJMO1xCu3huA01U2l8u1qWEJwtrX5OcdcFG6F55XsV/c DuNX0qh0NOibqaL3Gd6ejstsr0Ecc23ZwI7addjnKCRK1yQO6vlIFl96jFs+JvBSr5VO jonNYqFvhTqBO65W2OQoGrf5zxnRnQoT+WLkR18K458oLC5FvhZoygKpFCifJAd14HTS FW3Q== X-Gm-Message-State: AOAM531KTu9DXJlNlYs4Iog4ETsecp7LH1JPJSadK8iu8McG37gyE1+E yi8cT83o/cndAuchZIa9nNzSs+/JHFn9kUzqCC+mfQ== X-Received: by 2002:a63:1f21:: with SMTP id f33mr319808pgf.31.1611551198624; Sun, 24 Jan 2021 21:06:38 -0800 (PST) MIME-Version: 1.0 References: <20210117151053.24600-1-songmuchun@bytedance.com> <20210117151053.24600-3-songmuchun@bytedance.com> <472a58b9-12cb-3c3-d132-13dbae5174f0@google.com> In-Reply-To: From: Muchun Song Date: Mon, 25 Jan 2021 13:06:02 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v13 02/12] mm: hugetlb: introduce a new config HUGETLB_PAGE_FREE_VMEMMAP To: Randy Dunlap Cc: David Rientjes , Jonathan Corbet , Mike Kravetz , Thomas Gleixner , mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, Peter Zijlstra , viro@zeniv.linux.org.uk, Andrew Morton , paulmck@kernel.org, mchehab+huawei@kernel.org, pawan.kumar.gupta@linux.intel.com, oneukum@suse.com, anshuman.khandual@arm.com, jroedel@suse.de, Mina Almasry , Matthew Wilcox , Oscar Salvador , Michal Hocko , "Song Bao Hua (Barry Song)" , David Hildenbrand , =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= , Xiongchun duan , linux-doc@vger.kernel.org, LKML , Linux Memory Management List , linux-fsdevel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 25, 2021 at 12:09 PM Randy Dunlap wrote: > > On 1/24/21 8:06 PM, Muchun Song wrote: > > On Mon, Jan 25, 2021 at 7:58 AM David Rientjes wrote: > >> > >> > >> On Sun, 17 Jan 2021, Muchun Song wrote: > >> > >>> The HUGETLB_PAGE_FREE_VMEMMAP option is used to enable the freeing > >>> of unnecessary vmemmap associated with HugeTLB pages. The config > >>> option is introduced early so that supporting code can be written > >>> to depend on the option. The initial version of the code only > >>> provides support for x86-64. > >>> > >>> Like other code which frees vmemmap, this config option depends on > >>> HAVE_BOOTMEM_INFO_NODE. The routine register_page_bootmem_info() is > >>> used to register bootmem info. Therefore, make sure > >>> register_page_bootmem_info is enabled if HUGETLB_PAGE_FREE_VMEMMAP > >>> is defined. > >>> > >>> Signed-off-by: Muchun Song > >>> Reviewed-by: Oscar Salvador > >>> Acked-by: Mike Kravetz > >>> --- > >>> arch/x86/mm/init_64.c | 2 +- > >>> fs/Kconfig | 18 ++++++++++++++++++ > >>> 2 files changed, 19 insertions(+), 1 deletion(-) > >>> > >>> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c > >>> index 0a45f062826e..0435bee2e172 100644 > >>> --- a/arch/x86/mm/init_64.c > >>> +++ b/arch/x86/mm/init_64.c > >>> @@ -1225,7 +1225,7 @@ static struct kcore_list kcore_vsyscall; > >>> > >>> static void __init register_page_bootmem_info(void) > >>> { > >>> -#ifdef CONFIG_NUMA > >>> +#if defined(CONFIG_NUMA) || defined(CONFIG_HUGETLB_PAGE_FREE_VMEMMAP) > >>> int i; > >>> > >>> for_each_online_node(i) > >>> diff --git a/fs/Kconfig b/fs/Kconfig > >>> index 976e8b9033c4..e7c4c2a79311 100644 > >>> --- a/fs/Kconfig > >>> +++ b/fs/Kconfig > >>> @@ -245,6 +245,24 @@ config HUGETLBFS > >>> config HUGETLB_PAGE > >>> def_bool HUGETLBFS > >>> > >>> +config HUGETLB_PAGE_FREE_VMEMMAP > >>> + def_bool HUGETLB_PAGE > >> > >> I'm not sure I understand the rationale for providing this help text if > >> this is def_bool depending on CONFIG_HUGETLB_PAGE. Are you intending that > >> this is actually configurable and we want to provide guidance to the admin > >> on when to disable it (which it currently doesn't)? If not, why have the > >> help text? > > > > This is __not__ configurable. Seems like a comment to help others > > understand this option. Like Randy said. > > Yes, it could be written with '#' (or "comment") comment syntax instead of as help text. Got it. I will update in the next version. Thanks. > > thanks. > > >> > >>> + depends on X86_64 > >>> + depends on SPARSEMEM_VMEMMAP > >>> + depends on HAVE_BOOTMEM_INFO_NODE > >>> + help > >>> + The option HUGETLB_PAGE_FREE_VMEMMAP allows for the freeing of > >>> + some vmemmap pages associated with pre-allocated HugeTLB pages. > >>> + For example, on X86_64 6 vmemmap pages of size 4KB each can be > >>> + saved for each 2MB HugeTLB page. 4094 vmemmap pages of size 4KB > >>> + each can be saved for each 1GB HugeTLB page. > >>> + > >>> + When a HugeTLB page is allocated or freed, the vmemmap array > >>> + representing the range associated with the page will need to be > >>> + remapped. When a page is allocated, vmemmap pages are freed > >>> + after remapping. When a page is freed, previously discarded > >>> + vmemmap pages must be allocated before remapping. > >>> + > >>> config MEMFD_CREATE > >>> def_bool TMPFS || HUGETLBFS > >>> > > > > > -- > ~Randy >