From patchwork Mon Mar 7 13:07:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12771825 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 AFA7EC433EF for ; Mon, 7 Mar 2022 13:08:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 227948D0002; Mon, 7 Mar 2022 08:08:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FE858D0001; Mon, 7 Mar 2022 08:08:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C6E18D0002; Mon, 7 Mar 2022 08:08:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0039.hostedemail.com [216.40.44.39]) by kanga.kvack.org (Postfix) with ESMTP id F225A8D0001 for ; Mon, 7 Mar 2022 08:08:37 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 9F877A798B for ; Mon, 7 Mar 2022 13:08:37 +0000 (UTC) X-FDA: 79217619474.27.EE3111C Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by imf18.hostedemail.com (Postfix) with ESMTP id 62BC51C000A for ; Mon, 7 Mar 2022 13:08:36 +0000 (UTC) Received: by mail-pg1-f177.google.com with SMTP id q19so890447pgm.6 for ; Mon, 07 Mar 2022 05:08:35 -0800 (PST) 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=HJPfLXFh8zeL0ZGxZZAtDpaG7vHzuWPH4ZZJpp3Y79g=; b=f/e7pAUL9+MhXiC5/0IlcGejZvwIdXseqcgbxNJ2Sup/ujWZ5v52uvd+Odm9ZDaphn lxPc1WLidrEBle5uWhp2AwPySNNCA9SX4HQL/9I4jUuuhWZJ1e0JgeUoZaSu0En0WRqJ ON88vnF2LIU6qj56icOBNUjomTkvg7H12zSNbKGhy/ZRmHFwAJJVrPDFxxeeRX5voEXF n/fCSm+Z6VajvnzMeNpwGtZKhZ4UmtKqrg7eKt5FZMcvSPNC6ytsjw3j1+KCBSqGVKpG C42DlijM9tjRgaATdm+sTWwNhgCzpfPRO1YWghiCxjPgMRuzc/1Tm5VhhymbhceUB8fL HhrQ== 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=HJPfLXFh8zeL0ZGxZZAtDpaG7vHzuWPH4ZZJpp3Y79g=; b=buJpGVPvrTbe+Dk5eFcWgIiTh8Wsy4KhTR8wiOp0nHedOOTmcBRPz0xY4vO/ftZQOM 2rQ73ijyMGotymdZx73o6r6h55glr7cZann7FCIVut6vxgqOo71PXETvep0KgiSUjTX4 I3pxo253uKZaqNBh8ewXZPklW4heCMU2dGm9ya5t7eUZ+9YtvRGyh2odmtc8ylo0eiwJ 2C1LYa/V8LheZLYuHqRSwdLLv31Fx9PKcqTxIs9ytUrr87u6RXJ6t0Eqm7nJL4wnc56Q iJFGorY5PLHsU1TW3zr6IaY/F3pmGpkpBMFyw8Ypyw2F7Sf/P5TlaKI68dXSL+GD0RM3 pNiA== X-Gm-Message-State: AOAM530g6vdKIf3q/kcQY/o9CyTG2pqwNcpnbnZijXr3idQSwmr8CmTA 2rmplygtTG3lQ49lc9yz7W0TTg== X-Google-Smtp-Source: ABdhPJw5RDwGaMofaK51SgcgAGQmNJackUvqcMSogw6ycP0+UhBodVpqboWXcPaGByz0fNXkdDukBQ== X-Received: by 2002:aa7:9522:0:b0:4e1:d277:ce8 with SMTP id c2-20020aa79522000000b004e1d2770ce8mr12390233pfp.16.1646658514956; Mon, 07 Mar 2022 05:08:34 -0800 (PST) Received: from FVFYT0MHHV2J.bytedance.net ([139.177.225.245]) by smtp.gmail.com with ESMTPSA id x9-20020aa79409000000b004f704d33ca0sm3258528pfo.136.2022.03.07.05.08.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 05:08:34 -0800 (PST) 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 v3 0/4] add hugetlb_free_vmemmap sysctl Date: Mon, 7 Mar 2022 21:07:04 +0800 Message-Id: <20220307130708.58771-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 62BC51C000A X-Stat-Signature: 3hzew5pwjbuonicddqc3aicey5ed979m Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="f/e7pAUL"; spf=pass (imf18.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.215.177 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspam-User: X-HE-Tag: 1646658516-645882 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 amis to add hugetlb_free_vmemmap sysctl to enable the feature of freeing vmemmap pages of HugeTLB pages. 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: disable freeing vmemmap pages when struct page crosses page boundaries mm: memory_hotplug: override memmap_on_memory when hugetlb_free_vmemmap=on sysctl: allow to set extra1 to SYSCTL_ONE mm: hugetlb: add hugetlb_free_vmemmap sysctl Documentation/admin-guide/sysctl/vm.rst | 14 ++++ include/linux/memory_hotplug.h | 9 +++ kernel/sysctl.c | 2 +- mm/hugetlb_vmemmap.c | 113 +++++++++++++++++++++++++++----- mm/hugetlb_vmemmap.h | 4 +- mm/memory_hotplug.c | 27 ++++++-- 6 files changed, 143 insertions(+), 26 deletions(-)