From patchwork Thu Oct 10 15:22:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13830193 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 ADEB3CF11F5 for ; Thu, 10 Oct 2024 14:11:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A73836B0085; Thu, 10 Oct 2024 10:11:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D6746B0088; Thu, 10 Oct 2024 10:11:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 800436B0089; Thu, 10 Oct 2024 10:11:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 659156B0085 for ; Thu, 10 Oct 2024 10:11:44 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 60D6EC05FA for ; Thu, 10 Oct 2024 14:11:40 +0000 (UTC) X-FDA: 82657880928.23.CB021B4 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf08.hostedemail.com (Postfix) with ESMTP id 42EE2160017 for ; Thu, 10 Oct 2024 14:11:39 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; spf=pass (imf08.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=1728569457; 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=ejyIAcThZCfKnFMXQWKWyGAETZRqYgziZ+0ookqNxBA=; b=2XfjtJM2Z2DuVdCaOSoauhmpuBsAdH7LpB1jpqVXW+gE8jr9wcF3qRvqlpS3UCB2fQTle3 XxWzojtIkFefCmAuwJMWgxxoCkt5uWneb2peG9k6lNkdT1ds7o6zJvApEIXB//rV2pzd8T Q9y3BerQP6V1QODTAJhly0UGqD2Lq1Y= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; spf=pass (imf08.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728569457; a=rsa-sha256; cv=none; b=692tTlzgwnT8GgIbwnXM2Bjegd/LIa4DIIPfjKJfw0gucHOlWBoc/fHaRzpGK64pKcXGI9 AiJukcQYLFOtvrTwjg22vjgbGpxphkmseluZxCLKjQciGlJc28dUNXR9kfq90ZbGA+XRtN ByrML+AffTJyeyKsaAYafSj0auAv76A= Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4XPWrM1ZmgzCsrx; Thu, 10 Oct 2024 22:10:59 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 2FB1E180105; Thu, 10 Oct 2024 22:11:37 +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; Thu, 10 Oct 2024 22:11:33 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v3 -next 02/15] mm: filemap: move sysctl to mm/filemap.c Date: Thu, 10 Oct 2024 23:22:02 +0800 Message-ID: <20241010152215.3025842-3-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010152215.3025842-1-yukaixiong@huawei.com> References: <20241010152215.3025842-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-Rspam-User: X-Stat-Signature: mskpp86pnwh7zfdkcme6313yieuoequ7 X-Rspamd-Queue-Id: 42EE2160017 X-Rspamd-Server: rspam11 X-HE-Tag: 1728569499-763697 X-HE-Meta: U2FsdGVkX1/c7s37H+KyydJmwoFAXVKnSzppiUFcxEqPjdGGhWhy7pwtl5rlGhjnybKSf/C5OlMvoT/dlqwhjyMyFAaM+Vf/nXuZ4VIpqQby+QxSD32f5zg26THSH7nozaPIYy4/Yb4f55eNGhu73ZHrJPgO/HiJdpXosps+ToBoOfm0DRKWllGzpqrl7lIY/WnIVCm4Hs0ji3A1PCtZEbAM78/5v6C5wdoO/MLUDgfa3VxBeENzLcrIH88sKuQ5MMiBBj1qMHEV8+ck233RRfuxkubCMtBrmTpcrxDG5v0mT2kcOqHlBoS7zW6AQ3gDhcMbh4QIFSzv8OCcc/87uvNCxplcQNdlc15EADf2q95tOVHemSqFe9mGkSVX50f4TOzFhLOPPBuP7qThLdQBXT3Y+/LoYapQYPCFHBzYovI0QCtf376VaZmSukhnmI+q/JUdOEQS+aNRpz4GfRUXwVtnZdah5qhLPeqhD4x5sKX1uFpzKiznZJ1EgO2ZIxrU33BLw9toP50Sow5A/Dfh37mye9WNv5BrU6zblHb3oMfwebQqy+4cHoRMyESEujimYBWHyDMOMjhQW1s6t+//tBwYSJwCWgh8DfNpGZelZeAhcIQF4kq2FBrllOp9K6+wzMozN3H37BwfNn5qGcVdG/ELnGtHXAqzsxRUsnHGjfUH462sznAad/FXJov2ANK7tfmMTQ69lasAfggKlaj6TzI4VhICVvtzBlTBK65xhi3DHE7YVPG8EtASH9rF8bxZsEJWT3T2Sjkf/fzzlUwZEB702MRH/MG+exluJ6QjDahwVrlshXKPEyDpvXQnwV2y6bPZXc35EYdyq5Bk/lupre2v0nl3/VvdfJ07sM+OgvwtNVa7LbdGixSKvEoASpOCVofROM8TBab8VZGnKwwJyAUwUtI9Uido5ZqfZ2PbeU/vpw2xYlmJVFe5rvF+68GysWsf8kMC5cal7ZlcsW3 J+lcHBmu FqLiE8TnQE0rTACeT2Yi5h0LJGpMeE5vPNfRP4m9tnhQxDOdqu80b7pNXDVKbLqXSKzhOQZIBKKaGOOkyepNKldpRJdIrYCbptXPl8rSwhygmUXDHxmm4Abik2J4eqHBpy9sIkkcduRKYRICbGfYW1vt4Uam2uuj8nZShjwgnnCLgIlU= 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 --- 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 df0a5eac66b7..a3c3a7d64407 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 429895f1a564..0d4adf8068ca 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) {