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: 13787998 X-Patchwork-Delegate: paul@paul-moore.com Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94DF53207; Tue, 3 Sep 2024 03:31:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725334270; cv=none; b=X0g0grCA0rOwjIur8vaHRqnF4WpWABiqKtUVrxQ/2WUMW+4Rev/MCRD7GK9ArowTb1k1mKRgrc/M7faBpBwc3Izo6JoJtyamyrmw4l+ifNMLgKvPsgaT3HokdcJG2Z+Ja1rz2J+MTqx0snFcXfsyAoMlL1Npjyy8XkZPihEjmYM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725334270; c=relaxed/simple; bh=6vzSPTesoyblQaiz09hnnuu3vYtAYmlPfflMwWB/85A=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fgZHpA6bZbF8OsXBiSOIBhWhYnucujH8fE7V4seFGqxngHDRbw05Yjp8ghPaqtt1mibyCSIMUG+A3fx5Au9R8AstinqlwGJ64klu72e8wKN9u8dU0TJg6BnfifhQv52qiwnHtVNoYH1V6Lq+R5irg8aLwbfsrW1NyXuUK2vNafc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=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> Precedence: bulk X-Mailing-List: linux-security-module@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) 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) {