From patchwork Sat Jan 11 07:07:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935833 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 47BD9E7719A for ; Sat, 11 Jan 2025 07:12:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA5086B0095; Sat, 11 Jan 2025 02:12:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A07496B0096; Sat, 11 Jan 2025 02:12:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8CE9A6B0098; Sat, 11 Jan 2025 02:12:32 -0500 (EST) 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 74ACA6B0095 for ; Sat, 11 Jan 2025 02:12:32 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E59C6141117 for ; Sat, 11 Jan 2025 07:12:31 +0000 (UTC) X-FDA: 82994302902.01.897EAB3 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf15.hostedemail.com (Postfix) with ESMTP id 76F50A000F for ; Sat, 11 Jan 2025 07:12:29 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736579550; a=rsa-sha256; cv=none; b=oPqUfPbRNUvyguatXBOkZ19bOp/zrYA1xaCikkqbj3X1+LSh37oeBna6vbNf1eEapWJR1K cD8n91s6Woqr4oG+eigrTL7klpjTBiY5X+iwAkwIf58unQMm4aB/c2tdE0ZEDx0miqmYOv O5dCcWk8VK7z5MvF8OU+1yKpRbM+H04= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.188 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=1736579550; 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=6UBGVNvTgbcESqxAWZqyLJAFRd+PZBsONVz8Tk+d2Lc=; b=Oh9rOZm0slNus4Igxt5N4NkG7hLt8OBnfH2YuHcXDVaACaDT4JvISR7IBRyIQa60Kv+Ovr r5jE3dfvmtRQ8QwFHKn/uMp25jOxIULcyTJTMVnMdYPb8xHH2wdxsXnpU0VMThXWk/bKu0 hRYSoFjJ3L6IUVtJlBgpsMfErBDUsDM= Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4YVV4s40hhzbjqn; Sat, 11 Jan 2025 15:09:17 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 10BBC1401F3; Sat, 11 Jan 2025 15:12:24 +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, 11 Jan 2025 15:12:20 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 02/16] mm: filemap: move sysctl to mm/filemap.c Date: Sat, 11 Jan 2025 15:07:37 +0800 Message-ID: <20250111070751.2588654-3-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 76F50A000F X-Stat-Signature: kqk1rcreup8hbkcs5opdoz5hz1zs3m19 X-Rspam-User: X-HE-Tag: 1736579549-266211 X-HE-Meta: U2FsdGVkX18XfCE2ROTjELzCJRqOthPnZpuR9MyxqjYLF3ghoc3xgpCNXXQMuowEP+/bepbG+2Kf6HQbFlAcCzPfTG0w26GFxSz6LzDFhKpH0DIf3nP5j/puy6ofMKwuE11CLRjpbwDl8+GteIXufHYTOxNrB+4YwpRi7s4c77QyS0ieoBp98MkdvABJVCyK/u/o8ytNXUKtr/SWlkgA8LH5a2ZK25YryfIcTsYR9Xhc+MR5qLDuC+oEpPhhldN2DyV93PPBrHOIpDfUtH4+VU8Yw/NPJaVE8AaRXIpgHsu+mIcAz1D48h/s9dKw/pvRkmxZH9ljWU+XiJR5aeIYBBbPodmrprtlAOXCMhBpte7vE44EFK4BURO3+1z6Q6VSRZVtnFKlxAg5etHQRkoTnJfgTzcnAa8tJDA+YFD5k5ZeTNHN0SuevQt/3fW/BcoQIFIUssUGmxpytMu1cQVQd2UtvoDxTvV725Ogfz+DKrkaZ8CmHvWU08MK1Skv6vtnWsaZqFuzn/fB9qAkFtxovqBnZPPeS3l97chlUdam+SQKvxvD/ThXPusilYWmsIkWwpynIFGGxvFyL+lluW8rZItU75ODsfahYE0BavrnU/dRBK452KsDXi0l5Usa5WMIb+DvIPxmOhhvS524GBpMD7cF4utM8hJ7DUBqMNM1vL6fmBMHZENJ+kRqV/P0ARDTfWwJH6esAJ5W91mhHR26UCgXbzHJVnCSKR1CXsSiXmmbiw9G3tyqTrEnRCZ+RKvLRjeNCM6D8qLNx+lXaTXsmfu7G3LtV4wOf4IyZLsJYMiT9jQTPVBTQRKTjReqmHNCQjraVI+VSbRceWnOvMM3uLxpUDm0tlt64MoOe0XbjwS4btkRm0b8Y6HSBDsULLrQFmF+UxoFJkIBfIbO+7GuHbVJPGX8s0VDp+1b3k4xAE398l0Wy+vVF8uyKY7Oyrt15sGeCTmAqrCYbgqs9Be f5e1zdPE byNgm3+PBzjgasQQg/xCmqKi9zd4KJ4Pii168NyLiYOfUhAkdQJS6VV4RpgyHmE7P2gec9G7S3kA2CLWYqwkuZUXCeQEDdl4HhQtebrRwKJDGCmK6R+L4eUMAn7gpP/GDPK5DMs5RSxX/YlJIpPXYsYKpF+J5OB86hEPckVu+Xif9us4cCdtx7ELKpAs4JEYMEnMvZLTKN6L5Dr0MUlucjq3x6eOcE0W6ijcAl+x3wV4crvbHAPN1T3aHprZ1wZaqPHyDgQjyqWmz2OjCEfROF0lW+KSv5B6xjkTH+tkDGX0ihx3WkPMWIJj6c2BAnOpUr2pa 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 75c9b4f46897..b9a63a6c960f 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -41,8 +41,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 9a1aad0c66b9..29c131b84294 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -1078,6 +1079,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; @@ -1086,6 +1100,7 @@ void __init pagecache_init(void) init_waitqueue_head(&folio_wait_table[i]); page_writeback_init(); + register_sysctl_init("vm", filemap_sysctl_table); } /* @@ -1233,9 +1248,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) {