From patchwork Tue Sep 3 03:29:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13787951 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 B7380CD3429 for ; Tue, 3 Sep 2024 03:31:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 225B58D0128; Mon, 2 Sep 2024 23:31:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D5358D0119; Mon, 2 Sep 2024 23:31:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ECCAB8D0128; Mon, 2 Sep 2024 23:31:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id CC7968D0119 for ; Mon, 2 Sep 2024 23:31:11 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 841E4AAB6A for ; Tue, 3 Sep 2024 03:31:11 +0000 (UTC) X-FDA: 82522001142.06.76ACE33 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by imf24.hostedemail.com (Postfix) with ESMTP id EA0EE180003 for ; Tue, 3 Sep 2024 03:31:08 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.32 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=1725334174; 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=k643HuXqRo/qlFx0br9juOBCyLvqt/UZbp11IW/33Zs=; b=bHeYEsQ1an41ny4SR8E4EFiQOVStbwGMr1tDrrAAyHfdRJSORmS5lI/AbpEU1auuy1yMyE 1835QhtPqaMz/fH6JixAPvpQJkfCQo/5eW4GgN/QuxW7D+7iK68g02l8lvrhEApXB3rgMy O8LzqBuyyM8YldukcnbGG3poR8e+uj8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725334174; a=rsa-sha256; cv=none; b=ewFZAopcKFGYScf5tR98+28WrjHzpkwSY5Q0JGIytS3R6yCN2Pgu3l7gpWrVvrWGtyv1Q8 mBBKlXqUvZa8Ia8hx63CQNoxJebJYZII/vt/eUMzwTRops+E+gqZcOCigRt4wgS0cgeWSa 9eAdgT7Hf+ZpojDX71g454VjyWI1mSI= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4WyWLn4hysz1xwsQ; Tue, 3 Sep 2024 11:29:05 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id C9B1F18002B; Tue, 3 Sep 2024 11:31:05 +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; Tue, 3 Sep 2024 11:31:03 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 -next 02/15] mm: filemap: move sysctl to its own file Date: Tue, 3 Sep 2024 11:29:58 +0800 Message-ID: <20240903033011.2870608-3-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240903033011.2870608-1-yukaixiong@huawei.com> References: <20240903033011.2870608-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-Stat-Signature: k4ks4naeo7c59pbn6sg4n9cxnnm9k4cz X-Rspamd-Queue-Id: EA0EE180003 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1725334268-225218 X-HE-Meta: U2FsdGVkX18u+XOF0gaNfhORFS19e8a56WK+7CaHjon39lCZD4oiUQnvCYGWEhoy4sasZWk/c+csPvWDPknd32AJf6FEhksusB1o6rhj3uqwu6XKXIG1hFo/3RCb6TUivavCLzOP3qCysXtpUgmQ5T3AaZlRx2IqUfQdtJG8XPZrUfgqv50gZ13ikzCbqPlHUdTNn+e5UNqX+nY07+K65jdYv7ZmvJW6bo5yImCaWvmWmjGY3QvEX9XIks0LaznWlgc+S6o0pQPLYg+R3H3AomLqbVr0vnvwKigFHy5jp//GlC2CtEyRha8XKzp04cm5HKPJHOpAZToeix+QqCmqenmCZmeyPqwNVS9h8fyaOIS5arxHeQcyFLvTVTOd3YjvVWyObr/rM5d47e7dhqkWqUmy8gI8+sxm/Ivc2UDisC++CR3Qrmg2nbRsTlcqaaIYcL1TccKEnpbUDP0QhPUZ9sqE6/njkEIAYJ0zo5mLpYo6kZ3+tl5BSo7QXiTVC229kH5GNZZyK8j+AtxvTbBg78Dl4ht8FslyKR/fAqB4b+N/UMYSqxb7yXNRvr7DtfB0GIAEZbltEiJSqlXlXR0e3dlmJYpohYDPMdy7zfF3Pzit7cRVjstkUv6puGN6v8neIL7h4GpTnp3G4syCTjy9fJ4MM+wNAuGSJDLKMwphoGXCb0K7h1NSIEHFEg94NGqhFB0fcNXPaeMKuG06omxU2/4meYHKhrTjD3vDG59eWBf31B4WtfLM2tcKocz3MJERGHMCbqtkjLJ/+CqzBJaojbb6g8SdtGWVkAEphNb9g6E3DYTYsP4O1wXl8RAqBhU1jMyDYJn8qZinHPauNlMZQq0y7JtPxHaooTi4df4ub88AQ30ooFg7swVxqGgJeg/wfSK+VQJduSXVVl8Q9CAVFBLucRJFBFvBYJTgf7Gtjrv6naE92fyapZqI8YueaALSWur3zef9FijDqEXHEmE 5wFuaEFi +23gSiUIrR8NGVLtilaACrnf+puJ6eiHlwoisuAm77LUIxCnRJMJ4Q3tG5UfAl3t+W9/HcvfAKCisaaj+8a0DS8mVn6qK/3rK7/qOo/lqdjHLTwH0Ia/XE4rXpPS6mz7e+qlPNn17qd95X9nPNDGtVEqOlrdTPw+0JKqR 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 its own file, and removes the redundant external variable declaration. Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook --- 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 a7c74a840249..ca196ba1e2d8 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -39,8 +39,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 726b866af57b..2a875b739054 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2089,14 +2089,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 065d130c1c07..98e36e2b7290 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include "internal.h" @@ -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 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) {