From patchwork Fri Mar 18 10:07:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12785124 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 531ADC433EF for ; Fri, 18 Mar 2022 10:09:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C869E8D0002; Fri, 18 Mar 2022 06:09:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C372A8D0001; Fri, 18 Mar 2022 06:09:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AFCB98D0002; Fri, 18 Mar 2022 06:09:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0189.hostedemail.com [216.40.44.189]) by kanga.kvack.org (Postfix) with ESMTP id A142A8D0001 for ; Fri, 18 Mar 2022 06:09:11 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 5D8F6182895A2 for ; Fri, 18 Mar 2022 10:09:11 +0000 (UTC) X-FDA: 79257084102.28.01E7F9E Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by imf09.hostedemail.com (Postfix) with ESMTP id 83EA314001A for ; Fri, 18 Mar 2022 10:09:09 +0000 (UTC) Received: by mail-pj1-f50.google.com with SMTP id bx24-20020a17090af49800b001c6872a9e4eso3810114pjb.5 for ; Fri, 18 Mar 2022 03:09:09 -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=PqTragMvIuyF2G0eNMg49ec3Fe5cawaQAXvvejFzdIM=; b=qXwXkk0olJ0XDtllYBpfRHL/aedk+D1cB23bq8H1tudbY0Os+Et3oFOf/Pc0BG/5/+ +yRK9PawpTJwQCj4raaVJAb42DypRyfAXxCtqLS8U8Fea7c6vtzpkml1ByZ8uhEEGjr8 bgXf3ZcCDXwd5+UNeQpJ77RpXYAYAn+4MNuXKAPqgGbpJ3+ytYvR4hC8qlMq9k8cO8dF o7HtFAbnv7+MSQR/fZGvxk4MRO9YQHvmZu+LQwjqjThoVgHbnOltQrIgaijn7MrKHpMp 6HKtebsjY+zOhOE6rQ0TMgoxMpAwWJkZk3G3NKcHA2S4m6tA1IfLjRnjR7J4GY6Oc77a TbrA== 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=PqTragMvIuyF2G0eNMg49ec3Fe5cawaQAXvvejFzdIM=; b=cE9O3kSvLgyyZ0Crl6j4QqvgZOrtBRTls0zQXUvYnMmGANDEyJQG/wW7f9O5sy5Ack 0AJ5CmzsSnV8epAY59sX6zB7unaM5A256fORtxdiAonrJZY+Itr4OT0crYpBmlgi8vHC 0XISI4bOwUGb0dW8aIAOupXXVBTo39vymTDKBf6QRpbh+UNpKGnipYOw+sa5Y+ZyELjV +EiN9UByY3TsoG3k/eisvocRpIP1tDDk5V9Ui3V0//OOQmegoW5jaUF558zFZ9yC9+c2 fIkGMZsakgKo8GgusvU5R1mUQI4H06GfaeNhqzLJ0a5HY45w+XjrwbrlsZHJEURNijAO sqQQ== X-Gm-Message-State: AOAM530O0nICId82G1A/+TkVSjBjS+hkvGouylRJtVeVo+kW1S9pDp6L IOdHES3UHW74cCGlO+G35/6Cng== X-Google-Smtp-Source: ABdhPJwYPVd8MicGEiN4zrjKB2SVRMQvXml+oxRRxpDhAvQvmm05Oyp3FZLDCzGvE+iUQJwPVMmWCg== X-Received: by 2002:a17:903:32c3:b0:152:c1b:e840 with SMTP id i3-20020a17090332c300b001520c1be840mr9533735plr.40.1647598148363; Fri, 18 Mar 2022 03:09:08 -0700 (PDT) Received: from FVFYT0MHHV2J.bytedance.net ([139.177.225.241]) by smtp.gmail.com with ESMTPSA id j3-20020a056a00234300b004fa042e8216sm9541252pfj.2.2022.03.18.03.09.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Mar 2022 03:09:08 -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 v4 0/4] add hugetlb_free_vmemmap sysctl Date: Fri, 18 Mar 2022 18:07:16 +0800 Message-Id: <20220318100720.14524-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) MIME-Version: 1.0 X-Rspam-User: Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=qXwXkk0o; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf09.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.216.50 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 83EA314001A X-Stat-Signature: mybhtbeu6t6spcnrj8a4nrenh9hjbhyn X-HE-Tag: 1647598149-21822 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, 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. 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 | 12 ++++ fs/Kconfig | 2 +- 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 | 11 ++++ 12 files changed, 177 insertions(+), 35 deletions(-) create mode 100644 mm/struct_page_size.c create mode 100755 scripts/check_struct_page_po2.sh