From patchwork Mon Dec 23 14:15:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13918922 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 4B53DE7718B for ; Mon, 23 Dec 2024 14:20:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D32EC6B00D5; Mon, 23 Dec 2024 09:20:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CB9B36B00D6; Mon, 23 Dec 2024 09:20:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B5C3D6B00D7; Mon, 23 Dec 2024 09:20:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 8E7DB6B00D5 for ; Mon, 23 Dec 2024 09:20:39 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 4ACF41A18D7 for ; Mon, 23 Dec 2024 14:20:39 +0000 (UTC) X-FDA: 82926433044.27.AF20116 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf20.hostedemail.com (Postfix) with ESMTP id 0C6F31C0003 for ; Mon, 23 Dec 2024 14:19:56 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734963612; 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=JTwESPPXfyk3NPKTipsnOidV0Oa6V7JKphP1bpWuhhXDBcp6NB7AXFy3Cu9YSAj/jhh+3m fpsDDfvcuDdqyP0kmTLIA19GYOX3XOkdSK+7VCgWhrGOr7TpWlcRvt9+GSZXsjVaEuKIuC P1hPc//Qg3ooGMqdwWoLG7uPIz4ViEE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734963612; a=rsa-sha256; cv=none; b=5cBRafr34XDFnx/EY4cxwIpWvciLBa1Q0PW0XH3VL/7i5BTr7wtzJjzRfwR6JZniL+1BH5 +pvoIFSCerJt8jm+YPTvUCsVEXV+6RDEUg/Ao4/QSnABFqk5zjMypYS0SgC2DFU0RErqQE f6ZDLsctCs+Kip0wf6P54chHza2IKkQ= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4YH0Vy3mVgzRk4Y; Mon, 23 Dec 2024 22:18:34 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id A9E331403D1; Mon, 23 Dec 2024 22:20:32 +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:20:29 +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:37 +0800 Message-ID: <20241223141550.638616-19-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-Server: rspam02 X-Rspamd-Queue-Id: 0C6F31C0003 X-Stat-Signature: 9jbgzh9ixzisgb77tx4kjhta5izmifka X-Rspam-User: X-HE-Tag: 1734963596-261803 X-HE-Meta: U2FsdGVkX19koI+dz4Lu+AwfODJSj7+5ALaMFikQ0zfLgXoRltYUKcjJ74+7jzcP3+ggStXLvHjKTn7ZoIaavLb2R7lb8yJX43J5o+8uzRSAhK3rx64MseldBRyPpOJmYd5FkJeKdWCseN4uTVp9m0CVzH34Uxv8juZQ+Hhy+tNo0c247ReojCeLVjQHc/iWZHPDJcdUajF8Vryr//Ii0k0jRv/jM2Bls/0ZSA6G17t/ydQz7mOyjcjov8sYLNoT/59wu99cgBtOVI9SHQXtRMN/KiqAAM0XiCYUdG9sqMrjFFurlTcWzfiGqGkzUhIoou81hleer6FCFbOluESFtDvXo6VobkqJxSG4VLZx6sTMQcNmukOQ2nuifUgq0GOg4fNltuIV0+FoUNU2CGqqHjll3H8sH2cQlgXN7L/5tZzFzu1uCgj98QC+uOptrrbuISwoUy1jwIVbpsI8ca63ZvK9Lft/f8kOkfo1RW/mAdy3KSIVk8FGHIdCRD5EFK11t0KNXeEjmYg6cUXSE46SLNSW6HTNB3mIb5vO/6WvnJi+V3h/BG5ogOUH3G/7RmT8fQnhWmzoV+dA/pHooT7dulAYiNJSzQQQR3XYLIT7PF520FDpj+oJFlkwDxano5lQ2md3MPYop1Ckpi4apalG1AdDOUmNn+shbbQkKPWKmmG+YhAv9HZzOd03dm4L5ljh4cIYukLn27vS00FWkb2UsAc5yYVA4VOsadZOndqXmVeJg9+Td8AvPO4ttKGCyt4/q8wbDWFTV/0Q4Fd39ODqJoVufJD2kZG//1wIeV0fftsDLhF6COJkow4ka+V0vmx0HNgTejeiyxYZZiHCy/BabxlvqlLtaNyGfLp18G4sot0ian8Sf2bSo3gDtAar19cqjSsStQFYue6jxSxd/NMNhxlh+4zE57hEO7M4hFKL9+ZmWCKH83nM28Rm3HLEqBcV00A+vE7mGeG65TI+oPv SMVY6kq0 YRvveXb+1IAUsK8FmayxrdRc6fk84GMmILdYRE8oU/vhawkJwh88c7rIRu5m1srlZLjSzfEVhfttQXPPUNK8obKD6KXvkE2yr//6jdFhdvlAlz3L0qAh8HYHRunJTV0yE3lx4kwY7sZ2D5M7GaGsxBB+ETgkGR+SCiQDf0mYuDj7kayM= 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) {