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 4D403C433EF for ; Thu, 3 Mar 2022 11:15:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D4668D0002; Thu, 3 Mar 2022 06:15:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 75B628D0001; Thu, 3 Mar 2022 06:15:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 64BD78D0002; Thu, 3 Mar 2022 06:15:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 55AA38D0001 for ; Thu, 3 Mar 2022 06:15:44 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1C1E42542A for ; Thu, 3 Mar 2022 11:15:44 +0000 (UTC) X-FDA: 79202819808.03.06F6450 Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) by imf20.hostedemail.com (Postfix) with ESMTP id C0FFC1C000C for ; Thu, 3 Mar 2022 11:15:42 +0000 (UTC) Received: by mail-yb1-f176.google.com with SMTP id x200so9463816ybe.6 for ; Thu, 03 Mar 2022 03:15:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HoCF6NhxARCr3ueC6ZsYxpx/8H0Eb++Uzi1onIsqoOI=; b=vEyMm8AoudFkaUiSf63rN3f+y8qOG2p1y/HS/fJTPu1jm6bL42nRqFnoFdDWk0eOIM wCzc7FNE4wVhBJARwJalFPSk2FcLPnKaTOtkSwUef3OgINTy7HXa2sVBxjDJnJ1yGhxO WKm0iCHP9rlmjVEacE7KW27nIEUwBj7ExG2KwaoQjzPEbfJmlS+Xw5cY7cLNwtlyjmm4 8HntGVf2ezfkJ3yHo7X1k8k0/lmA356l/zbX0yaHFNej17DLMOJvyW+LDESdoPZxNby9 Vqoi+9OzQbmFmQLc5IACX+pgGYjrB4HD5QKAygv6e6vWDCxhVUKDC14SWRqSZYeIuk8I SDBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HoCF6NhxARCr3ueC6ZsYxpx/8H0Eb++Uzi1onIsqoOI=; b=WzzFQM1JHxogT8gB6EeBeO1yWlCGt17LzIQLLdgL14Evuwr2gKlPSImH4fgzj112QI pfI/Xz9iaRL4MO1/gv6iorKTq24BTnY2VH55nAw/4PCemqoTD7qIhrZExYUp2Z6chjuK 2ssSkd4R954aF6z+nPDlpLvlbCV/6ATOUJ/rDmpXMMO4eqzlqAFqGIyF6y3DV2Wt54SK dTU0pgk6EJRRptNaFPtaehNqGBb4RpT4qddBnoVSmfo/kRiSggefF1vvZQtiiqfsF/Ph k12RV6zwRWQO2CdL0O5A/XI414DXjnkR56inJbKrrK4OeiezLVjfHY37DLMOaQyCTO+y +zOQ== X-Gm-Message-State: AOAM533LfAwu7aVX1F/RTaViInfkWl/Kb8MgLNkIegdBpNEy6IP2ZDbb R3VgbLIOeDKx+l2mehYyTxMnr/7dPiFe84pPuQTlGw== X-Google-Smtp-Source: ABdhPJxaDIq/YEzZwJfm09LBLmjgPY+iewMxbF1kjAykJ3N+XvyUN9PxI2ut1UTmptmNB87P4qQubfrG5JzIp82VraM= X-Received: by 2002:a25:d188:0:b0:628:ba86:ee68 with SMTP id i130-20020a25d188000000b00628ba86ee68mr3937633ybg.427.1646306141760; Thu, 03 Mar 2022 03:15:41 -0800 (PST) MIME-Version: 1.0 References: <20220302083758.32528-1-songmuchun@bytedance.com> <20220302083758.32528-4-songmuchun@bytedance.com> In-Reply-To: From: Muchun Song Date: Thu, 3 Mar 2022 19:15:05 +0800 Message-ID: Subject: Re: [PATCH v2 3/3] mm: hugetlb: add hugetlb_free_vmemmap sysctl To: Luis Chamberlain 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 Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: C0FFC1C000C X-Stat-Signature: hwdnm1igik93h41snjoghij5awdkzda3 X-Rspam-User: Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=vEyMm8Ao; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf20.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.219.176 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-Rspamd-Server: rspam03 X-HE-Tag: 1646306142-597801 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 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. Thanks Luis.