Skip to content

Commit 73aa354

Browse files
yukaixiongJoelgranados
authored andcommitted
mm: filemap: move sysctl to mm/filemap.c
This moves the filemap related sysctl to mm/filemap.c, and removes the redundant external variable declaration. Signed-off-by: Kaixiong Yu <[email protected]> Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Joel Granados <[email protected]>
1 parent b8974b8 commit 73aa354

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

include/linux/mm.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ struct user_struct;
4040
struct pt_regs;
4141
struct folio_batch;
4242

43-
extern int sysctl_page_lock_unfairness;
44-
4543
void mm_core_init(void);
4644
void init_mm_internals(void);
4745

kernel/sysctl.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,14 +2079,6 @@ static const struct ctl_table vm_table[] = {
20792079
.extra1 = SYSCTL_ONE,
20802080
.extra2 = SYSCTL_FOUR,
20812081
},
2082-
{
2083-
.procname = "page_lock_unfairness",
2084-
.data = &sysctl_page_lock_unfairness,
2085-
.maxlen = sizeof(sysctl_page_lock_unfairness),
2086-
.mode = 0644,
2087-
.proc_handler = proc_dointvec_minmax,
2088-
.extra1 = SYSCTL_ZERO,
2089-
},
20902082
#ifdef CONFIG_MMU
20912083
{
20922084
.procname = "max_map_count",

mm/filemap.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include <linux/splice.h>
4848
#include <linux/rcupdate_wait.h>
4949
#include <linux/sched/mm.h>
50+
#include <linux/sysctl.h>
5051
#include <linux/fsnotify.h>
5152
#include <asm/pgalloc.h>
5253
#include <asm/tlbflush.h>
@@ -1078,6 +1079,19 @@ static wait_queue_head_t *folio_waitqueue(struct folio *folio)
10781079
return &folio_wait_table[hash_ptr(folio, PAGE_WAIT_TABLE_BITS)];
10791080
}
10801081

1082+
/* How many times do we accept lock stealing from under a waiter? */
1083+
static int sysctl_page_lock_unfairness = 5;
1084+
static const struct ctl_table filemap_sysctl_table[] = {
1085+
{
1086+
.procname = "page_lock_unfairness",
1087+
.data = &sysctl_page_lock_unfairness,
1088+
.maxlen = sizeof(sysctl_page_lock_unfairness),
1089+
.mode = 0644,
1090+
.proc_handler = proc_dointvec_minmax,
1091+
.extra1 = SYSCTL_ZERO,
1092+
}
1093+
};
1094+
10811095
void __init pagecache_init(void)
10821096
{
10831097
int i;
@@ -1086,6 +1100,7 @@ void __init pagecache_init(void)
10861100
init_waitqueue_head(&folio_wait_table[i]);
10871101

10881102
page_writeback_init();
1103+
register_sysctl_init("vm", filemap_sysctl_table);
10891104
}
10901105

10911106
/*
@@ -1233,9 +1248,6 @@ static inline bool folio_trylock_flag(struct folio *folio, int bit_nr,
12331248
return true;
12341249
}
12351250

1236-
/* How many times do we accept lock stealing from under a waiter? */
1237-
int sysctl_page_lock_unfairness = 5;
1238-
12391251
static inline int folio_wait_bit_common(struct folio *folio, int bit_nr,
12401252
int state, enum behavior behavior)
12411253
{

0 commit comments

Comments
 (0)