From patchwork Mon Dec 23 14:15:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13918955 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 0CD1DE7718D for ; Mon, 23 Dec 2024 14:19:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 93B4B6B00B2; Mon, 23 Dec 2024 09:19:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8EA0B6B00B4; Mon, 23 Dec 2024 09:19:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7628F6B00B5; Mon, 23 Dec 2024 09:19:47 -0500 (EST) 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 5A84B6B00B2 for ; Mon, 23 Dec 2024 09:19:47 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 0FC05AF4AC for ; Mon, 23 Dec 2024 14:19:47 +0000 (UTC) X-FDA: 82926431658.11.4470B7E Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf03.hostedemail.com (Postfix) with ESMTP id 1A8312000F for ; Mon, 23 Dec 2024 14:19:26 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.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=1734963567; 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=DrWd0FeM2jrAHnTiWf5Y6nez0/qEj0jb/w/pvhZDC5Y=; b=bf9u1lWKy8QVAi3GyAE4/peNb2NJv11hlJexfSazbRejLqLPkYevltKcyqI2XNoyaK1XdY 4UA6Xpd111uafsHU3lun++jDjNa4Pq07IlGjinHVV7zqIXXEdrVZr+Sb5T22GeLLvE5GiL qIoTFOjeYbjzWGFxvO70F9zRs9ED/2o= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734963567; a=rsa-sha256; cv=none; b=2ljzZgjr2EZjXrXGxba4wwW6AT2LBL7iQQJ/sRA2Q/feDHLSREFVQmjJUA7hy2jdHcsPWz 8oCb5+jqbpIxoHnLgMiWPDbJkmQQohoLMsvGYjZlGWcABit3WLpnoeCDvgQltl0LPIspZe JRHoU8TuAmD8NiUFFV6LR3sb1Pd8rxk= Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4YH0SM1Wztz11NKN; Mon, 23 Dec 2024 22:16:19 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id C2CF31800D1; Mon, 23 Dec 2024 22:19:40 +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, 23 Dec 2024 22:19:37 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 -next 02/15] mm: filemap: move sysctl to mm/filemap.c Date: Mon, 23 Dec 2024 22:15:21 +0800 Message-ID: <20241223141550.638616-3-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241223141550.638616-1-yukaixiong@huawei.com> References: <20241223141550.638616-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspamd-Queue-Id: 1A8312000F X-Stat-Signature: u5agkwe5xc6tep7yhnbriqp36gow414z X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1734963566-37230 X-HE-Meta: U2FsdGVkX19nYaXtyD/iOjn6GEZa0m+fIADn9O3VQZj9f1KRpWgqkk4/nn+J6R7rFNunRdD6R9qxR04ZZTDwOVQQvwYH1hZfEMCdffln7YUkvOMY44ulZcgB3D6oW6x1ewrPR1zYo8HEHy3DbS51g2AgxpMkHqyLdQ04psPAz0P3CKIM4VWbB1ZX37uEZyfdXGNf2cespjJEzMDVuj5T4QDfnrrcvmFAJqtxdOUiu8H4ZyoaSRjP1QyxPdTdD9bKDU8alN5qM5Hz9Utpih19R2wWn7kFCqUhXtGjfmWGRu90rYncjWMU6hWyqviFF/itcl9FVoLZXzrGGL8tCfzbBaKdmVlNkaNHgppnbrUftsLy12u1/PCjJggW4bDqcgsfxMmkPB1JR2Q5ZNODEY9J5YtINSQ0QUhBSDyrVxQgCVRRKKJQgn3XUG/sO/uef93SRLGnh+wXEKKVRgmi2R+awxROXtGbviDSTPbzgKXLqX6IVXM89vfgHUaD9NWHqV5ctnbUFo2Hb4AcVuMchAJhkIm2IID7Li18+P1rM01ETq2fHJPyFbay6OMwcAvwEVVaE7FE3JH+d+bQQ2F+ugwIryy9SOm4gI9VgXphALOYp9hZjDScPVUeZqOmfB1YOXKGwvS4XVuUhnj+pOFMmH+6w37XxCmpXZmA/00ssgQHNYp7YJNHfo+xdGbNnK2nqgFKzNUyqcdadMq2Vkp7zVNq5xA947jrr9XepsylT8UlGCey6MS2WsOQgGd+kZODBJOLzds/0EzZ8Ey2bXcC5TitPZf/z3x47wMcIk+2LXmOWuNkG9Ek0IKakHGJZlwo8fheobR9BZkaDJ68rChzx0Bh49XiBJ7pWMPp8dV/HMZ1EdOGcFk4WRYFjWErS7BrEl7lm3hliutBwjUKmZ9HH2UX3x8eexUkpE83+ulvDetQVH4mWl7JlsZns1yQ6I+8vaRV02t4hmkFLRN6JsPoK1T rbHBz/D8 JOdgYyh3pyDHVbCa6yqJP4/5bvmazcArBDwGEjNOwPvUd1512RaAkFKlfagVirGQ3SG7eDbRiTc7lLny/S5ZTkOrlpCq1Cqj2BhNBU6q2y1/hr/e/Xx19pp5IrWAuOAloVhovb0ATmrR/mQK11s0daqeHAlu4dwt5K3RbuppDlNvHCJo= 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: This moves the filemap related sysctl to mm/filemap.c, and removes the redundant external variable declaration. Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook --- v4: - const qualify struct ctl_table filemap_sysctl_table v3: - change the title --- --- include/linux/mm.h | 2 -- kernel/sysctl.c | 8 -------- mm/filemap.c | 18 +++++++++++++++--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index d61b9c7a3a7b..dbdf8950d681 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -40,8 +40,6 @@ struct user_struct; struct pt_regs; struct folio_batch; -extern int sysctl_page_lock_unfairness; - void mm_core_init(void); void init_mm_internals(void); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index f1ab251fc2d0..23c8db80da5d 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2079,14 +2079,6 @@ static struct ctl_table vm_table[] = { .extra1 = SYSCTL_ONE, .extra2 = SYSCTL_FOUR, }, - { - .procname = "page_lock_unfairness", - .data = &sysctl_page_lock_unfairness, - .maxlen = sizeof(sysctl_page_lock_unfairness), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = SYSCTL_ZERO, - }, #ifdef CONFIG_MMU { .procname = "max_map_count", diff --git a/mm/filemap.c b/mm/filemap.c index 899dab55d235..bb7aff8960a4 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -1069,6 +1070,19 @@ static wait_queue_head_t *folio_waitqueue(struct folio *folio) return &folio_wait_table[hash_ptr(folio, PAGE_WAIT_TABLE_BITS)]; } +/* How many times do we accept lock stealing from under a waiter? */ +static int sysctl_page_lock_unfairness = 5; +static const struct ctl_table filemap_sysctl_table[] = { + { + .procname = "page_lock_unfairness", + .data = &sysctl_page_lock_unfairness, + .maxlen = sizeof(sysctl_page_lock_unfairness), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + } +}; + void __init pagecache_init(void) { int i; @@ -1077,6 +1091,7 @@ void __init pagecache_init(void) init_waitqueue_head(&folio_wait_table[i]); page_writeback_init(); + register_sysctl_init("vm", filemap_sysctl_table); } /* @@ -1224,9 +1239,6 @@ static inline bool folio_trylock_flag(struct folio *folio, int bit_nr, return true; } -/* How many times do we accept lock stealing from under a waiter? */ -int sysctl_page_lock_unfairness = 5; - static inline int folio_wait_bit_common(struct folio *folio, int bit_nr, int state, enum behavior behavior) {