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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8347DC433F5 for ; Thu, 3 Mar 2022 14:59:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F36288D0002; Thu, 3 Mar 2022 09:59:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EE4FE8D0001; Thu, 3 Mar 2022 09:59:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD3AC8D0002; Thu, 3 Mar 2022 09:59:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id D196C8D0001 for ; Thu, 3 Mar 2022 09:59:34 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A850E251E1 for ; Thu, 3 Mar 2022 14:59:34 +0000 (UTC) X-FDA: 79203383868.02.B3028E4 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf15.hostedemail.com (Postfix) with ESMTP id 346FFA000C for ; Thu, 3 Mar 2022 14:59:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=rRwUAybaAGZPQgyHfYMkNr65Ww6gAF8vxx97N0fO01k=; b=Eexf+bW7N0NT8TMty7sO7cm+A0 UufwhWu+9FIfCy2G7p5948fd7tEeeEO2PrJB0z8cOlB3ZA54rZz80NuqR/DEtymr1JdwT/n1LsPhP swfluO79vBnQ2G2wbDFUu9t8LQCGS6cMUKPYOIHNPNVxR96jpsVYyZwBStrg6ccu4Jo+7fFJxNXfu fJs0bYUzWycLb6jd9jm4I9nUhsrAc5BL6L4OI4DVd52bQ5VnukjHvqTiQUAXGcXBHS9G/ArOH5nkm lcjxdQcRBzEcNpbTyPoKFWFaA1jQy22UdXoJMwseAfKakvOv89lx6edV31uGxh4R3rIROcG/AeUas 8ZwHYCKw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPmvK-006jV2-Sl; Thu, 03 Mar 2022 14:59:22 +0000 Date: Thu, 3 Mar 2022 06:59:22 -0800 From: Luis Chamberlain To: Muchun Song Cc: Jonathan Corbet , Mike Kravetz , Andrew Morton , Kees Cook , Iurii Zaikin , Linux Doc Mailing List , LKML , Linux Memory Management List , Xiongchun duan , Muchun Song , Adam Manzanares , Davidlohr Bueso Subject: Re: [PATCH v2 3/3] mm: hugetlb: add hugetlb_free_vmemmap sysctl Message-ID: References: <20220302083758.32528-1-songmuchun@bytedance.com> <20220302083758.32528-4-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 346FFA000C X-Stat-Signature: mhtqj76fckyg9dst5rgxw433uq5j8iwg Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Eexf+bW7; spf=none (imf15.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) X-HE-Tag: 1646319574-313159 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 03, 2022 at 07:15:05PM +0800, Muchun Song wrote: > On Thu, Mar 3, 2022 at 5:25 AM Luis Chamberlain wrote: > > > > On Wed, Mar 02, 2022 at 04:37:58PM +0800, Muchun Song wrote: > > > We must add "hugetlb_free_vmemmap=on" to boot cmdline and reboot the > > > server to enable the feature of freeing vmemmap pages of HugeTLB > > > pages. Rebooting usually taske a long time. Add a sysctl to enable > > > the feature at runtime and do not need to reboot. > > > > > > Signed-off-by: Muchun Song > > > --- > > > Documentation/admin-guide/sysctl/vm.rst | 13 ++++++++++ > > > include/linux/memory_hotplug.h | 9 +++++++ > > > mm/hugetlb_vmemmap.c | 42 ++++++++++++++++++++++++++++----- > > > mm/hugetlb_vmemmap.h | 4 +++- > > > mm/memory_hotplug.c | 5 ++++ > > > 5 files changed, 66 insertions(+), 7 deletions(-) > > > > > > diff --git a/Documentation/admin-guide/sysctl/vm.rst b/Documentation/admin-guide/sysctl/vm.rst > > > index f4804ce37c58..01f18e6cc227 100644 > > > --- a/Documentation/admin-guide/sysctl/vm.rst > > > +++ b/Documentation/admin-guide/sysctl/vm.rst > > > @@ -561,6 +561,19 @@ Change the minimum size of the hugepage pool. > > > See Documentation/admin-guide/mm/hugetlbpage.rst > > > > > > > > > +hugetlb_free_vmemmap > > > +==================== > > > + > > > +A toggle value indicating if vmemmap pages are allowed to be optimized. > > > +If it is off (0), then it can be set true (1). Once true, the vmemmap > > > +pages associated with each HugeTLB page will be optimized, and the toggle > > > +cannot be set back to false. It only optimizes the subsequent allocation > > > +of HugeTLB pages from buddy system, while already allocated HugeTLB pages > > > +will not be optimized. > > > > The commit log or documentation does not descrie why its safe to toggle > > one way and not the other? > > > > I thought it was easy to handle the transition from disable to enable > (code is simple). I might be wrong. I'll try to handle the other side in > the next version if it is not hard to handle. You should do the homework and explain why something is not possible. And if you are enabling to disable something why is it safe to do so at runtime? Luis