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=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 D7C02C433E0 for ; Thu, 11 Mar 2021 06:37:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4F9A764FB6 for ; Thu, 11 Mar 2021 06:37:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4F9A764FB6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CC3DB8D0275; Thu, 11 Mar 2021 01:37:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C73FC8D0250; Thu, 11 Mar 2021 01:37:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC6648D0275; Thu, 11 Mar 2021 01:37:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0231.hostedemail.com [216.40.44.231]) by kanga.kvack.org (Postfix) with ESMTP id 8DC358D0250 for ; Thu, 11 Mar 2021 01:37:14 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 53BA768B9 for ; Thu, 11 Mar 2021 06:37:14 +0000 (UTC) X-FDA: 77906636388.01.A196415 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by imf15.hostedemail.com (Postfix) with ESMTP id 346AAA0000FD for ; Thu, 11 Mar 2021 06:37:13 +0000 (UTC) Received: by mail-pg1-f173.google.com with SMTP id o10so13047787pgg.4 for ; Wed, 10 Mar 2021 22:37:13 -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=BeQyTYDxu+mGro++oymiELRqMwjIOrSXrDik0WPZ8lQ=; b=RZcW539H9MWd36hiZs7lgXBG+XKoPV1/UUl8taMCto0bKxozH4ZDvSAKp7CCZachZT 9E4blGTxybgDyo/hGSqFw7sL2STmxtGOq5RP9siA6QmFT97Ajcy7pLzzFDf495LWH73T URxCbfagkbTTmMqc/w79Jnc5wAMaRyNaoIC3NZu4wMOITPm3V3s9aMdcGW7DT9zNVXT9 vgXbom7xazFXS1mdWKxWVm7n6EZakzjJe4T9m++tMoXpdLNfmhYC5SwJjm43VxRapdZ7 pvmcJisV+ygxOLcHCTXiIa6dLt7Vb4417l/gcjGkTUc0+yaYuMCCDNfwCtF9ZfzMDyGK ZWpg== 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=BeQyTYDxu+mGro++oymiELRqMwjIOrSXrDik0WPZ8lQ=; b=ajEWVhH2OlyA+S/I+9MlJv5OwKgW+qRTZYh0+iT36H0atHzYX8bDE8qR0dH+avvNSk 7teYQT6ZMz377nMRZs8mqf7KKXIv+N/6ONFs5j8wBOvwhy2woUAC/e/5gwnMJW384U2u qUDi3CiePTMXqnkZBL2a/nIpGTjZEgoA5not0y3yab5lVEQbvLLTF3q99mGcGPHgnMyQ QusJlGPYQU5935Mf74YULFyxiOxlwkV3vBNoBY8e1e6S6HJr/O6iXSIWS6rKRMsVNEru MOplXD77ch5tniK6v+bJ3QBuvD9XxvR3Scq3WEF2RxxM5cQIQX8f8e49C7Z9ocS01oty Z6Gg== X-Gm-Message-State: AOAM53025JwqAB/Z7eUzOG9nO8vDqZcHWgOXYqaX8ejuJuu/5sYjamB/ BRSU0n0wl4x9dhYZATZVtjC2i5qfDgEctc8ThqHbVg== X-Google-Smtp-Source: ABdhPJzK1UAVUjPA7zmyTIvbrAACo4MlpKdGzW6HkdeVszf/4mbQp6NKD8Nx74e3KVQB9Isx/GWCwqffONxKsgnFRfA= X-Received: by 2002:a63:141e:: with SMTP id u30mr6156143pgl.31.1615444632963; Wed, 10 Mar 2021 22:37:12 -0800 (PST) MIME-Version: 1.0 References: <20210308102807.59745-1-songmuchun@bytedance.com> <20210308102807.59745-7-songmuchun@bytedance.com> <4ed29af1-1114-a085-d47d-21d646963ab7@infradead.org> In-Reply-To: <4ed29af1-1114-a085-d47d-21d646963ab7@infradead.org> From: Muchun Song Date: Thu, 11 Mar 2021 14:36:35 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v18 6/9] mm: hugetlb: add a kernel parameter hugetlb_free_vmemmap To: Randy Dunlap Cc: Michal Hocko , Jonathan Corbet , Mike Kravetz , Thomas Gleixner , Ingo Molnar , bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, Peter Zijlstra , Alexander Viro , 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 , David Rientjes , Matthew Wilcox , Oscar Salvador , "Song Bao Hua (Barry Song)" , David Hildenbrand , =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= , Joao Martins , Xiongchun duan , linux-doc@vger.kernel.org, LKML , Linux Memory Management List , linux-fsdevel , Miaohe Lin , Chen Huang , Bodeddula Balasubramaniam Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: nj8orcn1wou8o6mg9z3qc9zh49ozj3c1 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 346AAA0000FD Received-SPF: none (bytedance.com>: No applicable sender policy available) receiver=imf15; identity=mailfrom; envelope-from=""; helo=mail-pg1-f173.google.com; client-ip=209.85.215.173 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615444633-489016 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 Thu, Mar 11, 2021 at 1:16 AM Randy Dunlap wrote: > > On 3/10/21 7:37 AM, Michal Hocko wrote: > > On Mon 08-03-21 18:28:04, Muchun Song wrote: > >> Add a kernel parameter hugetlb_free_vmemmap to enable the feature of > >> freeing unused vmemmap pages associated with each hugetlb page on boot. > >> > >> We disables PMD mapping of vmemmap pages for x86-64 arch when this > >> feature is enabled. Because vmemmap_remap_free() depends on vmemmap > >> being base page mapped. > >> > >> Signed-off-by: Muchun Song > >> Reviewed-by: Oscar Salvador > >> Reviewed-by: Barry Song > >> Reviewed-by: Miaohe Lin > >> Tested-by: Chen Huang > >> Tested-by: Bodeddula Balasubramaniam > >> --- > >> Documentation/admin-guide/kernel-parameters.txt | 14 ++++++++++++++ > >> Documentation/admin-guide/mm/hugetlbpage.rst | 3 +++ > >> arch/x86/mm/init_64.c | 8 ++++++-- > >> include/linux/hugetlb.h | 19 +++++++++++++++++++ > >> mm/hugetlb_vmemmap.c | 24 ++++++++++++++++++++++++ > >> 5 files changed, 66 insertions(+), 2 deletions(-) > >> > >> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > >> index 04545725f187..de91d54573c4 100644 > >> --- a/Documentation/admin-guide/kernel-parameters.txt > >> +++ b/Documentation/admin-guide/kernel-parameters.txt > >> @@ -1557,6 +1557,20 @@ > >> Documentation/admin-guide/mm/hugetlbpage.rst. > >> Format: size[KMG] > >> > >> + hugetlb_free_vmemmap= > >> + [KNL] When CONFIG_HUGETLB_PAGE_FREE_VMEMMAP is set, > >> + this controls freeing unused vmemmap pages associated > >> + with each HugeTLB page. When this option is enabled, > >> + we disable PMD/huge page mapping of vmemmap pages which > >> + increase page table pages. So if a user/sysadmin only > >> + uses a small number of HugeTLB pages (as a percentage > >> + of system memory), they could end up using more memory > >> + with hugetlb_free_vmemmap on as opposed to off. > >> + Format: { on | off (default) } > > > > Please note this is an admin guide and for those this seems overly low > > level. I would use something like the following > > [KNL] Reguires CONFIG_HUGETLB_PAGE_FREE_VMEMMAP > > enabled. > > Allows heavy hugetlb users to free up some more > > memory (6 * PAGE_SIZE for each 2MB hugetlb > > page). > > This feauture is not free though. Large page > > tables are not use to back vmemmap pages which > > are not used Thanks. > > > can lead to a performance degradation for some > > workloads. Also there will be memory allocation > > required when hugetlb pages are freed from the > > pool which can lead to corner cases under heavy > > memory pressure. > >> + > >> + on: enable the feature > >> + off: disable the feature > >> + > >> hung_task_panic= > >> [KNL] Should the hung task detector generate panics. > >> Format: 0 | 1 > > > -- > ~Randy >