Received: by 2002:a05:6512:3d0e:0:0:0:0 with SMTP id d14csp1132548lfv; Thu, 14 Apr 2022 08:20:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYuAFtwrXHAS2UFkU/idltxwqvaJSc4A5IcIEE5YmF7ZYcBGQSJ1iGV6hL5meFDsRnT6Dy X-Received: by 2002:a63:f457:0:b0:39c:ec64:cd76 with SMTP id p23-20020a63f457000000b0039cec64cd76mr2711502pgk.381.1649949652019; Thu, 14 Apr 2022 08:20:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649949652; cv=none; d=google.com; s=arc-20160816; b=ND1MvtlOL68cSoAcJsHBsJWIY3d7dhiBnzuIrq5VQ1n2yldZxeDjEN+32S81ga9FXq UeLKzIFtULXivJCdf2OBRuN4sriECu7DvacxVFEr83ighrzLaEgucm8Lhi44fWZh0qi1 Hj1uoC/ggeYTmjaoL1DqNQSAB2Wsi6E7+j9cJ6TDvMAmvr6A1TJhPWl6Sc+K5f4xeAw7 NXwazILAi6PCZjC7P9l+ojtfTJgC7iGNrJNq6sTFq0H/1uJysQhkkISWmXD9zUENiREA Q3LHbHKYOHQeHc7raRMnM6zpP+O9iPeHZji7uCzFa10DghLvRXVX+NwFOkdjWEvSTjHk K0lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1Yvw2OdMv8Wer1zau2Qqgf9K5ZU91nVYs0auzDDWTAE=; b=pPRRNTt0n/lGsfg44g9HdFvcTsbRpzFOeEzDL6FQkMmBw4js2BNJc/NnXiYcg+w6eK Z934mOLJkZcmIeLnp0E7/ZYMjkiqLn4uYIwa8t6LiKNqCTQDvLmFtn3AeW3288LOv9pj BtuDryy9uGM7K8kl6i6nYXNXO6xvNJ6UtBEvRhSGJ/Vr02tq1nwn6VN7zRsXmXFOC1PB JODYoq+ChOqgVJp5xdUf0yUOs+tmG26GJ4m9UG8HA04v8MmDh9CTRtwsRyUc6oja3giH +MsdjxB1u9wUJdc114vd4B/DGwjZ7pVud67KviZoPJrQr634X6L95KeEKNq+lg38hn// nZOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=bS3J8H3+; 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 my18-20020a17090b4c9200b001cd57ed2fa8si2308342pjb.39.2022.04.14.08.20.36; Thu, 14 Apr 2022 08:20:52 -0700 (PDT) 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=bS3J8H3+; 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 S239795AbiDNEHC (ORCPT + 99 others); Thu, 14 Apr 2022 00:07:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbiDNEHA (ORCPT ); Thu, 14 Apr 2022 00:07:00 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFFB62BE2 for ; Wed, 13 Apr 2022 21:04:36 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id o5-20020a17090ad20500b001ca8a1dc47aso8180071pju.1 for ; Wed, 13 Apr 2022 21:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=1Yvw2OdMv8Wer1zau2Qqgf9K5ZU91nVYs0auzDDWTAE=; b=bS3J8H3+QDcELENjNFvFu9mMbmF7yl/dm/cHNSZD77rUAfzCe9dg8fvSJjVfy269p/ F4pXukydfJ+IYEmIARGce2SXHwi/Xobw+QcE4aHJrIhLdJY8E8Rztp1YdOdMz+J04beH kPjNyaNw6Rh10lB//HPNtNk6g2BOFgaBO1xUXewq9A3m45cttZbx3vvDqw7U40OvnyOS Ox+suMvZmkJo/95JiXjRp3k1+Sf9J6cKoqVuWoiWR0t9fJdzjz845b531wtTg54Qb7vP dnDh81pBKAw5qMMCcXvvX4KLfYAcZuTRisyE1z7mYpz30pc//2Npj+3wenshfAsYtbsq sLmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=1Yvw2OdMv8Wer1zau2Qqgf9K5ZU91nVYs0auzDDWTAE=; b=c5SKkfzBWYxnpeYKJn6hPRFvbqSqcCVtuoZfR/64QfcO3mDJIyd+mWn9Aty4z1lGyb j6T9FiVAU4yZO/hndM3jQn+ATtitWV4BH3EpDTZN8K7j1b1of3+efwCUoFrs1OX3le8N 4IIlOWEMucs0KKO/n+WbKA3ooVKkcl3uKue04wD+jIv5vWKXOSDYqWsLCoEPsLHGGAtX 34QEVgT0t5y+pjiHAQutaJIaoeLYSKPu7KqrIQiuPrm65YAKzg+xsJMUS8hfrS0SKsDn wwGbnUCaj7pdjTT5AXVii7T7ZqzBBf0qEl8e80U4iqwIGzqiyMLchX1ojpGLo0X2Kd6b J50Q== X-Gm-Message-State: AOAM530Ocu5JVbxSnP4mDE7O3Cs70UcOWIJLxNiDdocxVoFyOAQuD67n Z10OW1DtANCKil6dv8z/tVehUA== X-Received: by 2002:a17:903:284:b0:158:8e21:2108 with SMTP id j4-20020a170903028400b001588e212108mr9878098plr.37.1649909076271; Wed, 13 Apr 2022 21:04:36 -0700 (PDT) Received: from localhost ([139.177.225.245]) by smtp.gmail.com with ESMTPSA id w14-20020a63474e000000b0039cce486b9bsm565631pgk.13.2022.04.13.21.04.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Apr 2022 21:04:35 -0700 (PDT) Date: Thu, 14 Apr 2022 12:04:32 +0800 From: Muchun Song To: Andrew Morton 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 v8 4/4] mm: hugetlb_vmemmap: add hugetlb_optimize_vmemmap sysctl Message-ID: References: <20220413144748.84106-1-songmuchun@bytedance.com> <20220413144748.84106-5-songmuchun@bytedance.com> <20220413121051.a363193c726451115c634a69@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220413121051.a363193c726451115c634a69@linux-foundation.org> 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 Wed, Apr 13, 2022 at 12:10:51PM -0700, Andrew Morton wrote: > On Wed, 13 Apr 2022 22:47:48 +0800 Muchun Song wrote: > > > We must add hugetlb_free_vmemmap=on (or "off") to the boot cmdline and > > reboot the server to enable or disable the feature of optimizing vmemmap > > pages associated with HugeTLB pages. However, rebooting usually takes a > > long time. So add a sysctl to enable or disable the feature at runtime > > without rebooting. > > Do we really need this feature? Really? What's the use case and what > is the end-user value? > We know that this feature is disabled by default without passing "hugetlb_free_vmemmap=on" to the boot cmdline. When we (ByteDance) deliver the servers to the users who want to enable this feature, they have to configure the grub (change boot cmdline) and reboot the servers, whereas rebooting usually takes a long time (we have thousands of servers). It's a very bad experience for the users. So we need a approach to enable this feature after rebooting. This is a use case in our practical environment. > Presumably CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP worsens things for some > setups/workloads? Please tell us much more about that. What is the > magnitude of the deoptimization? > Most workloads are allocated HugeTLB from the pool not the buddy allocator, which are the users of this feature. However if the use case is that HugeTLB pages are allocated 'on the fly' instead of being pulled from the HugeTLB pool, those workloads would be affected with this feature enabled. Those workloads could be identified by the characteristics of they never explicitly allocating huge pages with 'nr_hugepages' but only set 'nr_overcommit_hugepages' and then let the pages be allocated from the buddy allocator at fault time. I don't know what the specific workload is. But I can confirm it is a real use case from the commit 099730d67417. For those workloads, the page fault time could be ~2x slower than before. I suspect those users want to disable this feature if the system has enabled this before if they don't think the memory savings benefit is enough to make up for the performance drop. Do you think it's ok if I put those information in the commit log or vm.rst? Thanks.