Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp33017pxb; Wed, 30 Mar 2022 22:08:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwobeS5WMje02mkHGsQXIEFl83brrFv838W2JRmBj0PBZ9Gd3L5hQYgZqTHPvxg9PlGOvNT X-Received: by 2002:a17:90b:3909:b0:1c7:9bc:a735 with SMTP id ob9-20020a17090b390900b001c709bca735mr4081636pjb.151.1648703290396; Wed, 30 Mar 2022 22:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648703290; cv=none; d=google.com; s=arc-20160816; b=HjGi+ca7FWKOdqlukRKJKKzGNNJURRbUHFr/4KYmC/bndue3Ajhg8VIKW5+5UrkJIt AUiqBQ+2YQ/psZ/jK411cj7DKoid/jI87LUO12TVQhIgQ0dh0drspcOuR4bljBq4Waiy nv5jlhIYxTkJekCOyFra/TZJpdEjfHOMwIdYOPfgZ+CyRAY4+9H0GLQPnowhYptGG+b0 Wg9Yh7iSoE8gxdlhBTzhqVbJqDVW+pLyg6uVLJYzvmZTdGRfwBv1NbcQFjqYlP4lJYw3 TPqxAj0WM9ebRFE0XIUQpz2rQaE2G2UlV2554JccDJ/8LkgQVG3W2Qk6xXQ4qo6w+Lf7 ZH9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=DiFQeUGd7A+03+aMdpiclSBOBy2basIn5ac75PngL1s=; b=VCZk1hpLJnKA9ot9BAv29JcKD0WHDlvGdu/7x50QrVzYrEMAxBWjiKqMDutQ1wN8KR K4v3kxt7kmi6DSLV0hHRZjYziDJGR93jqStWarGrhardoGAcw0APFby6u0ndPbqPxvYE he3gUO4ujLckJBYIotg2Q/oLMns+o9rP7tI0InMU+semlV2j1neHKObqgts1xLViS2V0 8cIUrVGS+kHEPX7Ps3ZnI4hxZlLhNT97WdvmT8QlbOuHD43dn9EmYRBOOglDdGlxCjBg PTrMwOeOfXzmV7Zmbjdf/vqZ71Ofev/wRCF6VcZYlB4jzPX1nxb0es16vG3uLHYiwiNL kJiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=xNMzbJ1x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a21-20020a17090aa51500b001bfaef1954dsi2143840pjq.45.2022.03.30.22.08.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 22:08:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=xNMzbJ1x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BB5E1122210; Wed, 30 Mar 2022 20:42:26 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230343AbiCaCiy (ORCPT + 99 others); Wed, 30 Mar 2022 22:38:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229680AbiCaCiv (ORCPT ); Wed, 30 Mar 2022 22:38:51 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 818E4B91A9; Wed, 30 Mar 2022 19:37:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id CAEADCE1F5F; Thu, 31 Mar 2022 02:36:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C38F1C340EE; Thu, 31 Mar 2022 02:36:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1648694218; bh=WQsddbrCat3Q5bzZv57YLMCPNyaJSVBl8uYP7TxTInU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=xNMzbJ1xwjJZk1Mxd47frKbLz4IPhdc9SUEeJID01zUHnI4aQ9cRhLtqNSUxVoXoH 6OnIxPBwplerroTchdn9azB6EI7JNoTyXEiGvk//Ep3ykgqrCLaYpti9oGDjBoOUIB ajw3i6Uz5NRga7Lqy2PjpiteUGv6u/U8Q930LZKY= Date: Wed, 30 Mar 2022 19:36:57 -0700 From: Andrew Morton To: Muchun Song Cc: corbet@lwn.net, mike.kravetz@oracle.com, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, osalvador@suse.de, david@redhat.com, masahiroy@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, smuchun@gmail.com Subject: Re: [PATCH v6 4/4] mm: hugetlb_vmemmap: add hugetlb_free_vmemmap sysctl Message-Id: <20220330193657.88f68bbf13fb198fb189bc15@linux-foundation.org> In-Reply-To: <20220330153745.20465-5-songmuchun@bytedance.com> References: <20220330153745.20465-1-songmuchun@bytedance.com> <20220330153745.20465-5-songmuchun@bytedance.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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 Wed, 30 Mar 2022 23:37:45 +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 takes a long time. Add a sysctl to enable > or disable the feature at runtime without rebooting. I forget, why did we add the hugetlb_free_vmemmap option in the first place? Why not just leave the feature enabled in all cases? Furthermore, why would anyone want to tweak this at runtime? What is the use case? Where is the end-user value in all of this? > Disabling requires there is no any optimized HugeTLB page in the > system. If you fail to disable it, you can set "nr_hugepages" to 0 > and then retry. > > --- a/Documentation/admin-guide/sysctl/vm.rst > +++ b/Documentation/admin-guide/sysctl/vm.rst > @@ -561,6 +561,20 @@ Change the minimum size of the hugepage pool. > See Documentation/admin-guide/mm/hugetlbpage.rst > > > +hugetlb_free_vmemmap > +==================== > + > +Enable (set to 1) or disable (set to 0) the feature of optimizing vmemmap > +pages associated with each HugeTLB page. Once true, the vmemmap pages of > +subsequent allocation of HugeTLB pages from buddy system will be optimized, > +whereas already allocated HugeTLB pages will not be optimized. If you fail > +to disable this feature, you can set "nr_hugepages" to 0 and then retry > +since it is only allowed to be disabled after there is no any optimized > +HugeTLB page in the system. > + Pity the poor user who is looking at this and wondering whether it will improve or worsen things. If we don't tell them, who will? Are they supposed to just experiment? What can we add here to help them understand whether this might be beneficial? > +See Documentation/admin-guide/mm/hugetlbpage.rst