Skip to content

Commit 7e05627

Browse files
yukaixiongJoelgranados
authored andcommitted
mm: swap: move sysctl to mm/swap.c
The page-cluster belongs to mm/swap.c, move it to mm/swap.c . Removes the redundant external variable declaration and unneeded include(linux/swap.h). 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 73aa354 commit 7e05627

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

include/linux/mm.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ static inline void totalram_pages_add(long count)
7676
}
7777

7878
extern void * high_memory;
79-
extern int page_cluster;
80-
extern const int page_cluster_max;
8179

8280
#ifdef CONFIG_SYSCTL
8381
extern int sysctl_legacy_va_layout;

kernel/sysctl.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
#include <linux/module.h>
2323
#include <linux/mm.h>
24-
#include <linux/swap.h>
2524
#include <linux/slab.h>
2625
#include <linux/sysctl.h>
2726
#include <linux/bitmap.h>
@@ -2044,15 +2043,6 @@ static const struct ctl_table vm_table[] = {
20442043
.mode = 0644,
20452044
.proc_handler = overcommit_kbytes_handler,
20462045
},
2047-
{
2048-
.procname = "page-cluster",
2049-
.data = &page_cluster,
2050-
.maxlen = sizeof(int),
2051-
.mode = 0644,
2052-
.proc_handler = proc_dointvec_minmax,
2053-
.extra1 = SYSCTL_ZERO,
2054-
.extra2 = (void *)&page_cluster_max,
2055-
},
20562046
{
20572047
.procname = "dirtytime_expire_seconds",
20582048
.data = &dirtytime_expire_interval,

mm/swap.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
/* How many pages do we try to swap or page in/out together? As a power of 2 */
4747
int page_cluster;
48-
const int page_cluster_max = 31;
48+
static const int page_cluster_max = 31;
4949

5050
struct cpu_fbatches {
5151
/*
@@ -1076,6 +1076,18 @@ void folio_batch_remove_exceptionals(struct folio_batch *fbatch)
10761076
fbatch->nr = j;
10771077
}
10781078

1079+
static const struct ctl_table swap_sysctl_table[] = {
1080+
{
1081+
.procname = "page-cluster",
1082+
.data = &page_cluster,
1083+
.maxlen = sizeof(int),
1084+
.mode = 0644,
1085+
.proc_handler = proc_dointvec_minmax,
1086+
.extra1 = SYSCTL_ZERO,
1087+
.extra2 = (void *)&page_cluster_max,
1088+
}
1089+
};
1090+
10791091
/*
10801092
* Perform any setup for the swap system
10811093
*/
@@ -1092,4 +1104,6 @@ void __init swap_setup(void)
10921104
* Right now other parts of the system means that we
10931105
* _really_ don't want to cluster much more
10941106
*/
1107+
1108+
register_sysctl_init("vm", swap_sysctl_table);
10951109
}

mm/swap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#define _MM_SWAP_H
44

55
struct mempolicy;
6+
extern int page_cluster;
67

78
#ifdef CONFIG_SWAP
89
#include <linux/swapops.h> /* for swp_offset */

0 commit comments

Comments
 (0)