From patchwork Wed Mar 23 12:55:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12789757 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 907EDC433F5 for ; Wed, 23 Mar 2022 12:57:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8A9806B0072; Wed, 23 Mar 2022 08:57:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 858856B0073; Wed, 23 Mar 2022 08:57:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7206E6B0074; Wed, 23 Mar 2022 08:57:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 635AB6B0072 for ; Wed, 23 Mar 2022 08:57:16 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 299C720771 for ; Wed, 23 Mar 2022 12:57:16 +0000 (UTC) X-FDA: 79275651672.13.EEC06A4 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by imf13.hostedemail.com (Postfix) with ESMTP id EC7322001D for ; Wed, 23 Mar 2022 12:57:14 +0000 (UTC) Received: by mail-pg1-f171.google.com with SMTP id c2so1037857pga.10 for ; Wed, 23 Mar 2022 05:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dlWHeuOtvbsHkw9sC0AFBolbbZkhOtKQrZPbL7UMiVo=; b=nBRZCUuOz35Bie3BZwHRuFwA7EvWa13fd7C9LX1eFGazkZDIsdOFyFPEo8F08O3aKs sMRaN9zwPj4HnrFW5olDavjqYrsfCdXcKl+SCJUgQ1y8rEzzhrhflSs7ASKmtsK7gcqB akMH04R3rozZEpysdCepSquR55lzMJfiQu0zdlxEUP7p3Z+mXYyxFwtJwtJazEUeHtSe AYDzr+ohyJRV2uBuabmdrSgMquRE6Yx21VyOxtcJ8C0hHN8bQTy1l0TRVccBjXsfZRlm 0nC4vz95qM47jecKgpSXTwg3Y3QmN10Y8RQYBGaxhNGqH8Eiki3anzLZ+dHWSkGvu3yW P+lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dlWHeuOtvbsHkw9sC0AFBolbbZkhOtKQrZPbL7UMiVo=; b=wBVB6zWPJcAfl4fr/IPTx7WfcOKcF/h2iInFHHc0AdnLcaBYq2jPmLaDpJeQp31+/V /i1Hszd0vP03dG7BckcSzMLRTmt8rkhXCIb0U/qu7oOxgALiQixOJy/5GYLSl5rZHAd/ tfqHLHUEBFqRVy5nOnBLkN+P83iJzvXmFJzhwB3h81sFqUEhQdaQdUpf6+kP4F2CvAmQ V8q/IR6jMwefzDMEdV+QGI8m2j+ddHONpgMjWXBcrZuN2jrSO1LocxMI+u20e7ai9ZO0 eUbJ4T8bL2q8X9T/hRor5jkSJNjWD1msjBA4G9dJDcVDvdnawzd1o8/gtjPKVKtaT6SK 5gZQ== X-Gm-Message-State: AOAM531FPK8/6LA1bXDr3oLjOycbe2bUDNsINMpzrMXlHoG4jNfuT68o BfAPupOEr1tAZvnEmyuHSZGJtA== X-Google-Smtp-Source: ABdhPJxc1Pi8YWlaKoR3Vrc+COpZGAeSLvAEixb+q0mIHCRa6IoNdqFz0C0di4sTLgKUSdkWWn7BaA== X-Received: by 2002:a63:5a49:0:b0:382:1ced:330e with SMTP id k9-20020a635a49000000b003821ced330emr22887174pgm.478.1648040233722; Wed, 23 Mar 2022 05:57:13 -0700 (PDT) Received: from FVFYT0MHHV2J.bytedance.net ([139.177.225.238]) by smtp.gmail.com with ESMTPSA id k185-20020a6384c2000000b003821dcd9020sm15716517pgd.27.2022.03.23.05.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 05:57:13 -0700 (PDT) From: Muchun Song To: corbet@lwn.net, mike.kravetz@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, osalvador@suse.de, david@redhat.com Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, smuchun@gmail.com, Muchun Song Subject: [PATCH v5 0/4] add hugetlb_free_vmemmap sysctl Date: Wed, 23 Mar 2022 20:55:19 +0800 Message-Id: <20220323125523.79254-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: p9pfjstaopaorco53owz5ktddcesca6x Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=nBRZCUuO; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf13.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.215.171 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-Rspamd-Queue-Id: EC7322001D X-HE-Tag: 1648040234-545854 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: This series is based on next-20220310. This series amis to add hugetlb_free_vmemmap sysctl to enable the feature of freeing vmemmap pages of HugeTLB pages. v5: - Fix not working properly if one is workig off of a very clean build reported by Luis Chamberlain. - Add Suggested-by for Luis Chamberlain. Thanks. v4: - Introduce STRUCT_PAGE_SIZE_IS_POWER_OF_2 inspired by Luis. v3: - Add pr_warn_once() (Mike). - Handle the transition from enabling to disabling (Luis) v2: - Fix compilation when !CONFIG_MHP_MEMMAP_ON_MEMORY reported by kernel test robot . - Move sysctl code from kernel/sysctl.c to mm/hugetlb_vmemmap.c. Muchun Song (4): mm: hugetlb_vmemmap: introduce STRUCT_PAGE_SIZE_IS_POWER_OF_2 mm: memory_hotplug: override memmap_on_memory when hugetlb_free_vmemmap=on sysctl: allow to set extra1 to SYSCTL_ONE mm: hugetlb_vmemmap: add hugetlb_free_vmemmap sysctl Documentation/admin-guide/sysctl/vm.rst | 14 +++++ Kbuild | 14 +++++ fs/Kconfig | 1 + include/linux/memory_hotplug.h | 9 +++ include/linux/mm_types.h | 2 + kernel/sysctl.c | 2 +- mm/Kconfig | 3 + mm/hugetlb_vmemmap.c | 107 ++++++++++++++++++++++++-------- mm/hugetlb_vmemmap.h | 4 +- mm/memory_hotplug.c | 27 ++++++-- mm/struct_page_size.c | 19 ++++++ scripts/check_struct_page_po2.sh | 9 +++ 12 files changed, 177 insertions(+), 34 deletions(-) create mode 100644 mm/struct_page_size.c create mode 100755 scripts/check_struct_page_po2.sh