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 27686C433DB for ; Thu, 11 Mar 2021 06:36:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 938B964FB9 for ; Thu, 11 Mar 2021 06:36:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 938B964FB9 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 1C80F8D0274; Thu, 11 Mar 2021 01:36:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 150D48D0250; Thu, 11 Mar 2021 01:36:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE6298D0274; Thu, 11 Mar 2021 01:36:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0182.hostedemail.com [216.40.44.182]) by kanga.kvack.org (Postfix) with ESMTP id CED248D0250 for ; Thu, 11 Mar 2021 01:36:43 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 761A9180ACEE8 for ; Thu, 11 Mar 2021 06:36:43 +0000 (UTC) X-FDA: 77906635086.09.6DB98CE Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf29.hostedemail.com (Postfix) with ESMTP id EA7ECDE for ; Thu, 11 Mar 2021 06:36:39 +0000 (UTC) Received: by mail-pj1-f49.google.com with SMTP id ha17so2200166pjb.2 for ; Wed, 10 Mar 2021 22:36:42 -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=F3D6jkjfAIdhrcFMdi8lIAUvY2kCMaCF37DRtFS3gwM=; b=nOvanrDQRINbuSw4dRh8vVphBVe9aAu/9Now9LsoOkZB0ka8L0/xyHDeINBijT2p48 Bl6Qi42KUg2hSIfAMA65+wQ17uAKciMMtotFCUC8I8/tRp1ktYzSaJeCXai4pUy5JJfd VxTNycFVz0i3cyPuZb8AVXLl+VwkWviQN+6CBTfXraaM8qVpp0eOoHNHWNhgFuR96uYO v5qdaB6VkSYkRwoOnhxWZb7+nXR6t+PUpXg8G7dHaJjKEKYisgZ8bNr6NubB9dgN6pLz Kan/5cXaAPa/ALyCphqr+4nEz77HQbg1TyOQrpnyU7f50n3AOBbl5YZOgByLNBY9vFN4 J3XQ== 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=F3D6jkjfAIdhrcFMdi8lIAUvY2kCMaCF37DRtFS3gwM=; b=rru2wX2IPW55z3b8FygiyLsMCjB1jTKq1v5r3p+q7BKcIHZs8rRuXO4WCV3CVsGSk3 rNTCHfmFIAPxVfQKrDoGr37wMXvPWCv3q82unHyCNU2dd/lGs3I8p7jZP1XG4OBK89ML u0F1TDQYKs3bjc4Yk+AI/TWo8vIzOxtA6sO8+PD01sNOCpno2js2xr5bO3wt2bhBi7uj CMb8W1Gt8RYQHAUIhk1DLUE/dEQ1bx2za3F2y81LT15jxDUH4HlC4a8GVy9hjWaTScgf bUtPuu8eDsqpXPbP8Xf8fpcJ+001cuyakNcYJCkYzsxH4wZwKefLJXRtil/j4XSnb821 M2Dw== X-Gm-Message-State: AOAM530ruhvF8nvPMTZAz3mRQnChl0sCufoL68BEcqfFC95pvAKVqrjC QurBcZofB53YD3ZuwKdxEjeTofMRDHkWB02kxhbUZQ== X-Google-Smtp-Source: ABdhPJyuvjbucZ4H5bOplCMAaZBYTLRCk/7ZefVaR7LNivXYFib9KTRuXnuCJe66IQ2aHfi43ZJ30KxMKzxzVn9P4D4= X-Received: by 2002:a17:90a:901:: with SMTP id n1mr7489410pjn.147.1615444601814; Wed, 10 Mar 2021 22:36:41 -0800 (PST) MIME-Version: 1.0 References: <20210308102807.59745-1-songmuchun@bytedance.com> <20210308102807.59745-7-songmuchun@bytedance.com> In-Reply-To: From: Muchun Song Date: Thu, 11 Mar 2021 14:36:03 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v18 6/9] mm: hugetlb: add a kernel parameter hugetlb_free_vmemmap To: Michal Hocko Cc: 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, Randy Dunlap , 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: jtg4uid4sdjjohi8xwk49u9sfw9jndbn X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: EA7ECDE Received-SPF: none (bytedance.com>: No applicable sender policy available) receiver=imf29; identity=mailfrom; envelope-from=""; helo=mail-pj1-f49.google.com; client-ip=209.85.216.49 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615444599-317918 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 Wed, Mar 10, 2021 at 11:37 PM 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 OK. > 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 > 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. Very thanks. I will update this. > > + > > + on: enable the feature > > + off: disable the feature > > + > > hung_task_panic= > > [KNL] Should the hung task detector generate panics. > > Format: 0 | 1 > -- > Michal Hocko > SUSE Labs