From patchwork Sat Dec 28 14:57:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13922364 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 6CBF4E7718F for ; Sat, 28 Dec 2024 15:01:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EBF856B0083; Sat, 28 Dec 2024 10:01:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E477C6B0085; Sat, 28 Dec 2024 10:01:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC2296B0088; Sat, 28 Dec 2024 10:01:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id A1CED6B0083 for ; Sat, 28 Dec 2024 10:01:56 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2F51C16170E for ; Sat, 28 Dec 2024 15:01:56 +0000 (UTC) X-FDA: 82944681540.15.B5A7F6F Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf14.hostedemail.com (Postfix) with ESMTP id 7AF2110001C for ; Sat, 28 Dec 2024 15:01:03 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf14.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.255 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=1735398094; 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=glTEWIO7darejH60wRXG2jixeTYGbIMa9U/FTqMP2uVbg0/GgsciJs+wt/8/wm1B0tMRYe 7Gd9MW0kjJcpHwAZE0HmdOWKjbqrE4D0pNpT4F7UAfm3GPuvjLEK6ICSPWch/zu09rqrJG CXGKn73ZkeOQ9gHunoguYtjHg8AtEEg= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf14.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735398094; a=rsa-sha256; cv=none; b=Fb6eE/w7uPgmSsoRetRejccmruEMww3zVOvs+pHXaute45okA9i2xkwO2bxbWMLj9UoRTh YaicEbGyiqlWbCpcvho+nO4S+csxk8GYHphLbRmVXwukPFeRPau1FlMHtrAJeV0VgIwQ7s mA4Ns4iBmx2YtE3ku1CzykWTMl0lJCU= Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4YL58X74JGz1W352; Sat, 28 Dec 2024 22:58:20 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id C20E118006C; Sat, 28 Dec 2024 23:01:48 +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; Sat, 28 Dec 2024 23:01:45 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 -next 02/15] mm: filemap: move sysctl to mm/filemap.c Date: Sat, 28 Dec 2024 22:57:33 +0800 Message-ID: <20241228145746.2783627-3-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241228145746.2783627-1-yukaixiong@huawei.com> References: <20241228145746.2783627-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspamd-Queue-Id: 7AF2110001C X-Stat-Signature: ybwewfd3x3uhapgbqr7hpd4kpyqm8atz X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1735398063-708955 X-HE-Meta: U2FsdGVkX1+7efjvycoMf6iYBCxbsP3ufESk1WM3fDlLrCUQtf0CoXGdEqxky2xMf6ES+A58nYSjYtfwLHidCiMHxIpDpPh6A+6e0LTDFSn0vpxJXknTIq4nFnVvULD2CXg2apfJhZC9OEXdDE8VcC7p+Vyxp5nu5yYXU7wHAYQ5WQRJsfKn9oVEhFucKjZ8iyj5MJOCRlFZ7bpZ7WyTGD/uD8Ydn3qUkSkTaYtovX3DJe7kP1sxLG/ZwCf+YmjwQFJSNx/NW7KN+Nk0MW2MjKoC7cTJlEPFawj1q/EcEWZHcyTnff8rjlGHRLuIFDRZYRV2pk0tIuUjl13thXt2dJgdP8VwfOO3Ym+qHcyGowtXMi3vjnJ7Km63NdacIkAEcLaGQFxfD3JAHt66fAW138tzf3keuesxobHusxuiVU7jkZZAMXwhGiFG/EwaHKQixDUVfB3vQG+k04TkCm6GS71GdPTvByB/wV06bSlkv/pa8eAAjxdCWT3Ip29FExU1C2tnE233Rm39LTjYg6VX/4hIEaDs1NQ69u8I0tXVxeLetjPajcZqkWgahYZF+y5QgqzWREqJv1Mrbw/AD3hK++ukUx6AZXbBu1fP8CMTD72Key9RO7q7DkF8Ud1qMp0kSgTQSk7M7Px17wLZe5pvRtfYSBbbDxuyxNyDq5EMExbutSMhNbLu5grrucg/jU2mro60OouzG9V4MsJwWxtg951sFYmzkRr2C9xEulzaXe6KLsBsVmYXFVdLQ4yepFHofePTplxsvZjraqSoi1sXlKX5Ic8i0zOQG7695WUJG28sRplFZctY9GR1qG/OGX35Jp9JtCA+7XxulZrobKjLycwHyu2Sn6sG4gxkRaAa/f9RBBjafdl9w6iGSi03kEkVBQ1B1/7XpusTvyWh6zUYHzy1T/XZoPiDpELx8IFORqm6UJsoCX7GNWixpiT5M+d22JiqCy+DqpBPe5Fd74H 7Gpgj0RN k1W46XWQRZJhwaLtiU1ctJbkD3RSrShNBOT6IEAmA/wRVva0XiNOv7QjujSZVuXB2ZJTX7OiweWzc7trWhGMEUPhfRhZ1cYb0kWX+g3vAkPfRrWREljL1GFY/krjluk4ZJMgfKlIbLXURXIVLBLb9GXjL8YDJdV/zCm/dm9bP9B1AH5S8L/yBzDi1yQPVs8TSKAcF3W9+geTg59DUGMflXVtaIICypoBJEOlevMYbcM7YEQfoqsOj5DQVKcJ4GTC+qbOKIhrM58VwJRxauQ9BuAQr8qF6bvmQyKJ0gCRbUWl90b7dxVH0cw5gTDcbj83jSSfk 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) {