From patchwork Mon Aug 26 12:04:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777709 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 0873DC5321E for ; Mon, 26 Aug 2024 12:05:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A315A6B03D5; Mon, 26 Aug 2024 08:05:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 96C026B03D6; Mon, 26 Aug 2024 08:05:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C1326B03D8; Mon, 26 Aug 2024 08:05:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 440DF6B03D5 for ; Mon, 26 Aug 2024 08:05:45 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A806AC0F79 for ; Mon, 26 Aug 2024 12:05:44 +0000 (UTC) X-FDA: 82494267408.27.7768909 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf28.hostedemail.com (Postfix) with ESMTP id 4359AC001C for ; Mon, 26 Aug 2024 12:05:41 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf28.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724673847; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S1V+Rp15DjldrUPTW94Oc0PG9xvMtXHLdP1+mL4FV3s=; b=p9kC4LgZ/xaylcMn/JiLCC+DPT3FFCDqflb/w8oM3GCz/c8wmR9MtTK9HpL1bFaUOJn5jh 8c8/8K0iJNvLLhOhZ3DcVD0RgFsvMpsNqR+jJ6VuB4FyIN3FE/9HMwdV0ca4m9Tq6rdg5r SVvDEdjJt2roY5M1wzN5KDh1Es0vaeI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724673847; a=rsa-sha256; cv=none; b=061K+TEC/F3hCbzR0d9X9s2vqcrX1NIp3htzREGXq5CXSCIMtxN+4XkSN20p1beixx9JTm u9hc6D/hETwEm5b9YgNXNe2yLp3xfXSW249xbOL4pPXz1E9nB1KwrShAiT/FHOcmJocP7u afr29DHxcqExISPTXM/DFw/S5j5Wl5E= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf28.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Wsq9d3wqzzyQKn; Mon, 26 Aug 2024 20:04:53 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 6A46E1404FC; Mon, 26 Aug 2024 20:05:39 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 26 Aug 2024 20:05:36 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 08/15] mm: nommu: move sysctl to its own file Date: Mon, 26 Aug 2024 20:04:42 +0800 Message-ID: <20240826120449.1666461-9-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 4359AC001C X-Stat-Signature: nthpr3wq69rbfhsrp7n3gsraq8y4fcsd X-Rspam-User: X-HE-Tag: 1724673941-947675 X-HE-Meta: U2FsdGVkX1/MUxjTnq7Xm5iJ1LX1FKpYp0p5HACS0U/63XAEAejhZg5vEf801+AfIUgXi0gYUwDJgpcdAb1d57P/kNqt2VZFwrE9CTLDvlPslue+ZvaCYhkD/UPZLW8Y3ZuDCsEZVhWpqB/BZ/wJIT4ouerg5QD855BT6n/Uygw8KOxWgIsMrTV/716MkqI2QjW1CKBSdIXO17eNDZj/R6und1Q0DuOerbv6iltnVpmqixtluLp4bfumgOqHYZ6y1lPh1vuGRzn0DDoL7oMDoKHu2VOY6WxEqWs3P+guyAcAqhCav4P8L6WBiuM54BvHeZkhFEVNI1HNwecLoxVR/I9gMEsLbKvzTIjvV5sfZZWjsufXEcrd26bEgTf2I2LQXP96HZN0HJtNLhvhaYidZHjMysQvLQwAfci2qXeqocXlVyRoxYgTG9Nt2Q/mHSOLnHbpjPg43GUu3/7sZmCzHsJExzP6/xn0ce/xm2JN0mAC8ULXtDpX8j6UmM2VMVmIbSKImyEmub9qY65LDTx2uzzd8t1Q+IOp88afL3Ke+pXAq2RfTJholdzypefCPYn8UAuZXv0L4ZjGhejLvcQ59xTuKuAfaROZiEBT537VxSJKsY9sNVBTerXtL/z5sWgqwMuL1Q4AdYuEm502UQvkHvGaVN13KVwXaMq7G2Hfb9mN6RsSxL04v/Ij24Mzlhi8Fp0fy4oej7HrJupFbFNJDCbxFCF7T38wFHf84P7CN/i7q9oi5RLY3aR60dCmhVe3bx3cBpu6XXTepBdIX3KW3A4kvDSv6ZWLi2aj2eiK0+6UfaFHfIOZn49Trt+bP+Z51MbqWVG2Bw6KwXZCYar48d70e75bcwuWFw8Ys/1N5tb1Fl4HTp10PqguugFVcaHJwoA7pY3mQSKPTSiAVlzYY6T7JJ51eTqTv3TQgCu/kINf+vOUMoNP3UQGN+FwkShbntM55Cgu3C2fpFCreZ5 qJg6b+Z1 VkIr81aa/o2kYptQOoIDA5axPQxYvHeF/NFOKfo42700xErJJ3O5KIhgQSRgNv73Ka9FKekER/0qfaoNqIUcX33zkVVrzrCwUafccE3NPpRjIQb18jfG1d/u8tugwsDRGWQbO2z5Q2tG71r8T5hGFH5qrHA== 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: List-Subscribe: List-Unsubscribe: The sysctl_nr_trim_pages belongs to nommu.c, move it into its own file from /kernel/sysctl.c. And remove the useless extern variable declaration from include/linux/mm.h Signed-off-by: Kaixiong Yu --- include/linux/mm.h | 2 -- kernel/sysctl.c | 10 ---------- mm/nommu.c | 15 ++++++++++++++- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 9400c92b4522..9e37d46fa666 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3972,8 +3972,6 @@ unsigned long wp_shared_mapping_range(struct address_space *mapping, pgoff_t first_index, pgoff_t nr); #endif -extern int sysctl_nr_trim_pages; - #ifdef CONFIG_PRINTK void mem_dump_obj(void *object); #else diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 0c0bab3dad7d..d3de31ec74bf 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2041,16 +2041,6 @@ static struct ctl_table vm_table[] = { .extra1 = SYSCTL_ONE, .extra2 = SYSCTL_FOUR, }, -#ifndef CONFIG_MMU - { - .procname = "nr_trim_pages", - .data = &sysctl_nr_trim_pages, - .maxlen = sizeof(sysctl_nr_trim_pages), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = SYSCTL_ZERO, - }, -#endif { .procname = "vfs_cache_pressure", .data = &sysctl_vfs_cache_pressure, diff --git a/mm/nommu.c b/mm/nommu.c index 385b0c15add8..983ee961dd67 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -48,7 +48,6 @@ struct page *mem_map; unsigned long max_mapnr; EXPORT_SYMBOL(max_mapnr); unsigned long highest_memmap_pfn; -int sysctl_nr_trim_pages = CONFIG_NOMMU_INITIAL_TRIM_EXCESS; int heap_stack_gap = 0; atomic_long_t mmap_pages_allocated; @@ -392,6 +391,19 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) return mm->brk = brk; } +static int sysctl_nr_trim_pages = CONFIG_NOMMU_INITIAL_TRIM_EXCESS; + +static struct ctl_table nommu_table[] = { + { + .procname = "nr_trim_pages", + .data = &sysctl_nr_trim_pages, + .maxlen = sizeof(sysctl_nr_trim_pages), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + }, +} + /* * initialise the percpu counter for VM and region record slabs */ @@ -402,6 +414,7 @@ void __init mmap_init(void) ret = percpu_counter_init(&vm_committed_as, 0, GFP_KERNEL); VM_BUG_ON(ret); vm_region_jar = KMEM_CACHE(vm_region, SLAB_PANIC|SLAB_ACCOUNT); + register_syscall_init("vm", nommu_table); } /*