From patchwork Wed Mar 30 15:37:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12796031 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 E8388C433EF for ; Wed, 30 Mar 2022 15:38:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 134056B0072; Wed, 30 Mar 2022 11:38:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0E35D8D0002; Wed, 30 Mar 2022 11:38:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EC59E8D0001; Wed, 30 Mar 2022 11:38:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id DF9496B0072 for ; Wed, 30 Mar 2022 11:38:23 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id AC00E2071D for ; Wed, 30 Mar 2022 15:38:23 +0000 (UTC) X-FDA: 79301459286.06.C69C375 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by imf12.hostedemail.com (Postfix) with ESMTP id 98D2E40013 for ; Wed, 30 Mar 2022 15:38:22 +0000 (UTC) Received: by mail-pj1-f54.google.com with SMTP id mr5-20020a17090b238500b001c67366ae93so178394pjb.4 for ; Wed, 30 Mar 2022 08:38:22 -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=IKVFgArMfLAYb/4tYUuGf6KEnDE92hMEQ9mU5hp/SXo=; b=y426lP1h9/gpMDvFsvkQcsWTR6r4t0uNFPGCXcCkQ0w4bDDfbd2I6w3MPvmSngD5aQ 9UHKY99m4xTMn2S+VEWYRysvmEDjOdp+p+AaJE9UQlAtOAg9nnObmnt7SD/llMP+ydXX tEoTC4CvY+Alaz3nGiPuulcsMVs4yV+CghqyvhjrIdjT4SEbjXtkkYdOiUQNNPovNO65 zooFZEF1EAKY+iSmwmGDYeeIlMmOyMmQg3y3cSgjUo/6mm1bLvfygA1ZudpOBLvdKOnK IAyYWShhvc4qIrg9j5+ZR6S93sOYQk7CUSaTKoYVYl/japXdL0WlkQnS9qvagsSwyJE5 F5Uw== 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=IKVFgArMfLAYb/4tYUuGf6KEnDE92hMEQ9mU5hp/SXo=; b=To4N922xfBDccoBnB3SGlGhSnn1Y+2wiGAtcLPL1J3if/aM4qRS8XUs+ZOdozgMyRB 3JQJaRRFSKxfAJ0uWGmiX7aL5rvakVBbVdoT5CHWOV2lZ6B2wLOcmShKY+Ga5XMbAEpy S73XksjxK4CMlCx0Xif/svOvJQFFW0jjkyhvz+Sy2Pfp/xgt5SVLL78C/cKtLggrr47e /LxIVIx/0E6S0u6I4I+HSQdHmCiZvhmgwVuhF+fqqofIyk1x4p+9475kjytaK4ITBm5b VKvbZfxbkw5iSmdsID26ygQD+/m7BBI0CPhe3uQWcl9I2iCoe6itg+6c6fJbutd2isSA /+kQ== X-Gm-Message-State: AOAM530zvODgq/lzeiONkSRWqAk6R68VPmoJVk+yA7+EbGv0m644azEF v+ul19VY5LvOtFfOHWhOh+RXxQ== X-Google-Smtp-Source: ABdhPJyx8KyO7z1oyOwVys9x6GkHA4ruaJjbZc4MyGqZcrWkQvN5DIzM1+TzQgmsyw0Tgim4c9azmA== X-Received: by 2002:a17:902:d3c5:b0:154:a3b5:d918 with SMTP id w5-20020a170902d3c500b00154a3b5d918mr161632plb.91.1648654701358; Wed, 30 Mar 2022 08:38:21 -0700 (PDT) Received: from FVFYT0MHHV2J.bytedance.net ([139.177.225.239]) by smtp.gmail.com with ESMTPSA id y8-20020a17090aa40800b001c6ccb2c395sm6686039pjp.9.2022.03.30.08.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 08:38:21 -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, masahiroy@kernel.org 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 v6 0/4] add hugetlb_free_vmemmap sysctl Date: Wed, 30 Mar 2022 23:37:41 +0800 Message-Id: <20220330153745.20465-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) MIME-Version: 1.0 X-Stat-Signature: qeyutwaeur84oa4cr4rcxxjj9wy1cah5 Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=y426lP1h; spf=pass (imf12.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.216.54 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 98D2E40013 X-HE-Tag: 1648654702-713118 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. v6: - Remove "make syncconfig" from Kbuild. 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 | 15 ++++- include/linux/memory_hotplug.h | 9 +++ include/linux/mm_types.h | 2 + include/linux/page-flags.h | 3 +- kernel/sysctl.c | 2 +- mm/hugetlb_vmemmap.c | 109 ++++++++++++++++++++++++-------- mm/hugetlb_vmemmap.h | 8 ++- mm/memory_hotplug.c | 27 ++++++-- mm/struct_page_size.c | 20 ++++++ 10 files changed, 171 insertions(+), 38 deletions(-) create mode 100644 mm/struct_page_size.c