Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp721420pxm; Thu, 3 Mar 2022 03:21:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUq9opZM5SLcdl6aMy8XYSRUuNpHmCED+f7SbaNGw6f12atjG9unRnXaSaVYBidSSqzMsR X-Received: by 2002:a17:902:d884:b0:14d:d2b6:b69 with SMTP id b4-20020a170902d88400b0014dd2b60b69mr35089396plz.40.1646306514877; Thu, 03 Mar 2022 03:21:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646306514; cv=none; d=google.com; s=arc-20160816; b=x+ah3Tf33yfBssH4ukMpjQCIJ5nKXNWnDtaFuu44cgiAxEli2A2Px265koJ9YbkXIs ZroqkVdzlTEjALHHgnGBX+ESwcTcELYVC3JBvNkzfclYeK/wJ40SXX8k1slQAolvPNUV idbP0M9mWjvewmxENR8pVaQuGSpas+bDv+jbXIdaJD0AIjTf7VDwW4E0xsdhz2ekSopq NM/VTwyyl4IkQDYGAsJ348OKheSrNzo3VYd5gbtyaH6EqBQmoYLOUmKRPsJOl5XuMFQ+ eyF1yG0z1gWa1fAytvi+gJbepBTztzKv2OQp3dPze9O7cXzGZWpNjF9QkcBopw+g3GCf hP8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=HoCF6NhxARCr3ueC6ZsYxpx/8H0Eb++Uzi1onIsqoOI=; b=e3Vc27e90YXQhFQpJMgkuozEuSXFfCx+jIjWfruD/Zfl6+fkAqW7L88BJsoH1cLF9B vmoz8UlnWsWu0EicanRgma61LbwB5Eg0iXUaKHeSyk0KSC6xbQCMG8g9GJJru71ra6Qs y8gBuxyqf4nwtuHGwh1Wc4SZacr781J+xz5xmiTklVw9MuwqpTJrsKnqqsspHTe9T3zq T5Hpc9wX8BInPpu12W6WlJQFCJi9Jl5O7Bph64PLctcL3lmtTB0unr6S1MVM8wkNZhQ9 KA/ciGEAlFISwkuFPOV0HeYa92R8ZQtpKYy3S9zIirGqhmBaQBcNHF0Njp/rwqIW3Mgn W0og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=vEyMm8Ao; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x3-20020a170902ec8300b001519c5a3c98si1884002plg.223.2022.03.03.03.21.39; Thu, 03 Mar 2022 03:21:54 -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=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=vEyMm8Ao; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232672AbiCCLQ3 (ORCPT + 99 others); Thu, 3 Mar 2022 06:16:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231876AbiCCLQ2 (ORCPT ); Thu, 3 Mar 2022 06:16:28 -0500 Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B25101688F0 for ; Thu, 3 Mar 2022 03:15:42 -0800 (PST) Received: by mail-yb1-xb32.google.com with SMTP id j2so9575935ybu.0 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=TTJNB5zynwndDlYpCvvD00I97hnJOY4cbkyaIbE4LCbbsIi7z6Za5Z0e+TS/MZuA13 LCLQ8qyoy1/f3PcwHtd367d645q1Qv7zcONNrGIoHwjJtb4p3ZobB/d7iaMOIyYBDx8A T2/7eC4ESwPlMfwYafe1K3s9vbSOOBpTcoT16RpjdRybi5/Lgy3PmJDk+klja5d3H2xd M80INEdahdLwdIORHJvigRZI5XjLbrsxmDGUnFjfhlWfZmblS8xx49iNMo3Tf8DLXBBD jKHp/iT4kMnoc8qLG6GxvR3969DBTVYstcU6NU97/ob2IOSmNe1tFiVDW4M2BWdbfjk8 l7DQ== X-Gm-Message-State: AOAM531M7F2IPtE6/C/guetQk9KGbdtUyLLfrLg7PBavyuMXmNLMELo1 zdPpmT1/WNqhMzyKG6LMdPRZTXupMKHFYPSHGY6OOA== 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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.