Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1144228pxm; Thu, 3 Mar 2022 11:10:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJRhVKCt5bDvRGwI86z7C5JFDk2KdjQPN0KgP/9aBLHxctHT4zVpKuCZkX1zlIBRKAFwek X-Received: by 2002:a17:907:1c91:b0:6d7:b83:cddb with SMTP id nb17-20020a1709071c9100b006d70b83cddbmr10399109ejc.739.1646334604238; Thu, 03 Mar 2022 11:10:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646334604; cv=none; d=google.com; s=arc-20160816; b=GoSdRU7SgmscKYkyJgny/MoZUdcHQ+bYv26ONDxS7BzzU8SxAzTbSMbTX51yPlZsgD PSbGDNOVAX08MfdlPoiz7NO4rJO0UJg5eX2CrbdLroepJSuLSRv0/I+lfzfjGyu81v3d rVlgT3Wqt2ab9YonqIxOcEXtR3ZY+LZoA7LSz+QUB6gBxH7V2y4MIME240a0S03SpqFb ngliv2FypEKvym7jLBbm8RDxTTl5vhS4MqmVPPLSDzODosk0B9dQLgxF1qCPW+s6jsDJ 2CxV4uGwXdKAzH6zlTqae5KbzUMuV8gt9Ro97bwfwjLnCzpsHm/G+5JEdFEgIdWqyKEp VHiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=rRwUAybaAGZPQgyHfYMkNr65Ww6gAF8vxx97N0fO01k=; b=RkNipDryZZCjuzXTcGcKgANZb4LIHZDqeJP3lI5b+m3gXRKEg08IaTclu435v53ZaD SkH/wFcW/AKA+r4tjYZ82A10Cac4IwAsdGWZuHk/gC2iIOrVa8uhy8RPgOwVW1qo82e0 w3uMSS71/3l6SRQ1rz/+1JIp6ONgs0inONRQtFsBtUPyQKfTiUchg4yqsCcYhMOf/eZ/ 8fpU8poV3K7rXhf7f0LlpjF3rWQFIQtevXYB1Zm/W2uleKBpbEvf7d2thgMF+pQLy68F +QFIzawtAhEktQtK8zmAMWCcGnECyrck6agsmfprHHhQCH7ml4nFe/h/Ll5KIBepzLgK oPEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=Eexf+bW7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq28-20020a1709073f1c00b006d7f8be0070si2186922ejc.290.2022.03.03.11.09.40; Thu, 03 Mar 2022 11:10:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=Eexf+bW7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234206AbiCCPAU (ORCPT + 99 others); Thu, 3 Mar 2022 10:00:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232579AbiCCPAR (ORCPT ); Thu, 3 Mar 2022 10:00:17 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA24FDE2F8; Thu, 3 Mar 2022 06:59:31 -0800 (PST) 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: Sender: Luis Chamberlain X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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