* [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files
@ 2025-01-11 7:07 Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 01/16] mm: vmstat: move sysctls to mm/vmstat.c Kaixiong Yu
` (16 more replies)
0 siblings, 17 replies; 25+ messages in thread
From: Kaixiong Yu @ 2025-01-11 7:07 UTC (permalink / raw)
To: akpm, mcgrof, joel.granados
Cc: ysato, dalias, glaubitz, luto, tglx, mingo, bp, dave.hansen, hpa,
viro, brauner, jack, kees, j.granados, willy, Liam.Howlett,
vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever, jlayton,
neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
paul, jmorris, linux-sh, linux-kernel, linux-fsdevel, linux-mm,
linux-nfs, netdev, linux-security-module, dhowells, haifeng.xu,
baolin.wang, shikemeng, dchinner, bfoster, souravpanda, hannes,
rientjes, pasha.tatashin, david, ryan.roberts, ying.huang, yang,
zev, serge, vegard.nossum, wangkefeng.wang
This patch series moves sysctls of vm_table in kernel/sysctl.c to
places where they actually belong, and do some related code clean-ups.
After this patch series, all sysctls in vm_table have been moved into its
own files, meanwhile, delete vm_table.
All the modifications of this patch series base on
linux-next(tags/next-20250110). To test this patch series, the code was
compiled with both the CONFIG_SYSCTL enabled and disabled on arm64 and
x86_64 architectures. After this patch series is applied, all files
under /proc/sys/vm can be read or written normally.
my test steps as below listed:
Step 1: Set CONFIG_SYSCTL to 'n' and compile the Linux kernel on the
arm64 architecture. The kernel compiles successfully without any errors
or warnings.
Step 2: Set CONFIG_SYSCTL to 'y' and compile the Linux kernel on the
arm64 architecture. The kernel compiles successfully without any errors
or warnings.
Step 3: Use QEMU to boot the kernel compiled in Step 2, then use the
Linux command |ls -ll /proc/sys/vm/| to check the permissions of all
sysctls under the |/proc/sys/vm| directory.
When compared with the kernel version that did not apply this series of
patches, there is no difference in the sysctl permissions under the
|/proc/sys/vm| directory between the two kernel versions.
Step 4: Repeat steps 1 to 3 on the x86_64 architecture.
Changes in v5:
- add reviewed-by from Lorenzo Stoakes in patch6,8
- Accept Brian Gerst's suggestion to reduce the preprocessor
condition "#elif (defined(CONFIG_X86_32) && !defined(CONFIG_UML))"
in patch13
- fix the error discovered by Geert Uytterhoeven in patch14 in V4.
Move the call to register_sysctl_init() into its own fs_initcall()
as Geert Uytterhoeven's patch does.
- take the advice of Joel Granados, separating patch14 in V4 into
patch14 and patch15 in V5. patch14 in V5 just moves the vdso_enabled
table. patch15 in V5 removes the vm_table.
- modify the change log of patch14
- clarify test steps.
Changes in v4:
- due to my mistake, the previous version sent 15 patches twice.
Please ignore that, as this version is the correct one.
- change all "static struct ctl_table" type into
"static const struct ctl_table" type in patch1~10,12,13,14
- simplify result of rpcauth_cache_shrink_count() in patch11
Changes in v3:
- change patch1~10, patch14 title suggested by Joel Granados
- change sysctl_stat_interval to static type in patch1
- add acked-by from Paul Moore in patch7
- change dirtytime_expire_interval to static type in patch9
- add acked-by from Anna Schumaker in patch11
Changes in v2:
- fix sysctl_max_map_count undeclared issue in mm/nommu.c for patch6
- update changelog for patch7/12, suggested by Kees/Paul
- fix patch8, sorry for wrong changes and forget to built with NOMMU
- add reviewed-by from Kees except patch8 since patch8 is wrong in v1
- add reviewed-by from Jan Kara, Christian Brauner in patch12
Kaixiong Yu (16):
mm: vmstat: move sysctls to mm/vmstat.c
mm: filemap: move sysctl to mm/filemap.c
mm: swap: move sysctl to mm/swap.c
mm: vmscan: move vmscan sysctls to mm/vmscan.c
mm: util: move sysctls to mm/util.c
mm: mmap: move sysctl to mm/mmap.c
security: min_addr: move sysctl to security/min_addr.c
mm: nommu: move sysctl to mm/nommu.c
fs: fs-writeback: move sysctl to fs/fs-writeback.c
fs: drop_caches: move sysctl to fs/drop_caches.c
sunrpc: simplify rpcauth_cache_shrink_count()
fs: dcache: move the sysctl to fs/dcache.c
x86: vdso: move the sysctl to arch/x86/entry/vdso/vdso32-setup.c
sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c
sysctl: remove the vm_table
sysctl: remove unneeded include
arch/sh/kernel/vsyscall/vsyscall.c | 20 +++
arch/x86/entry/vdso/vdso32-setup.c | 16 ++-
fs/dcache.c | 21 ++-
fs/drop_caches.c | 23 ++-
fs/fs-writeback.c | 30 ++--
include/linux/dcache.h | 7 +-
include/linux/mm.h | 23 ---
include/linux/mman.h | 2 -
include/linux/swap.h | 9 --
include/linux/vmstat.h | 11 --
include/linux/writeback.h | 4 -
kernel/sysctl.c | 221 -----------------------------
mm/filemap.c | 18 ++-
mm/internal.h | 10 ++
mm/mmap.c | 54 +++++++
mm/nommu.c | 15 +-
mm/swap.c | 16 ++-
mm/swap.h | 1 +
mm/util.c | 67 +++++++--
mm/vmscan.c | 23 +++
mm/vmstat.c | 44 +++++-
net/sunrpc/auth.c | 2 +-
security/min_addr.c | 11 ++
23 files changed, 336 insertions(+), 312 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH v5 -next 01/16] mm: vmstat: move sysctls to mm/vmstat.c
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
@ 2025-01-11 7:07 ` Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 02/16] mm: filemap: move sysctl to mm/filemap.c Kaixiong Yu
` (15 subsequent siblings)
16 siblings, 0 replies; 25+ messages in thread
From: Kaixiong Yu @ 2025-01-11 7:07 UTC (permalink / raw)
To: akpm, mcgrof, joel.granados
Cc: ysato, dalias, glaubitz, luto, tglx, mingo, bp, dave.hansen, hpa,
viro, brauner, jack, kees, j.granados, willy, Liam.Howlett,
vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever, jlayton,
neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
paul, jmorris, linux-sh, linux-kernel, linux-fsdevel, linux-mm,
linux-nfs, netdev, linux-security-module, dhowells, haifeng.xu,
baolin.wang, shikemeng, dchinner, bfoster, souravpanda, hannes,
rientjes, pasha.tatashin, david, ryan.roberts, ying.huang, yang,
zev, serge, vegard.nossum, wangkefeng.wang
This moves all vmstat related sysctls to its own file, removes useless
extern variable declarations, and do some related clean-ups. To avoid
compiler warnings when CONFIG_PROC_FS is not defined, add the macro
definition CONFIG_PROC_FS ahead CONFIG_NUMA in vmstat.c.
Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
Reviewed-by: Kees Cook <kees@kernel.org>
---
v4:
- const qualify struct ctl_table vmstat_table
v3:
- change the title
- change sysctl_stat_interval to static type
---
---
include/linux/vmstat.h | 11 -----------
kernel/sysctl.c | 28 ---------------------------
mm/vmstat.c | 44 ++++++++++++++++++++++++++++++++++++++----
3 files changed, 40 insertions(+), 43 deletions(-)
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 9f3a04345b86..4751e3ecc467 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -10,15 +10,8 @@
#include <linux/static_key.h>
#include <linux/mmdebug.h>
-extern int sysctl_stat_interval;
-
#ifdef CONFIG_NUMA
-#define ENABLE_NUMA_STAT 1
-#define DISABLE_NUMA_STAT 0
-extern int sysctl_vm_numa_stat;
DECLARE_STATIC_KEY_TRUE(vm_numa_stat_key);
-int sysctl_vm_numa_stat_handler(const struct ctl_table *table, int write,
- void *buffer, size_t *length, loff_t *ppos);
#endif
struct reclaim_stat {
@@ -304,10 +297,6 @@ void quiet_vmstat(void);
void cpu_vm_stats_fold(int cpu);
void refresh_zone_stat_thresholds(void);
-struct ctl_table;
-int vmstat_refresh(const struct ctl_table *, int write, void *buffer, size_t *lenp,
- loff_t *ppos);
-
void drain_zonestat(struct zone *zone, struct per_cpu_zonestat *);
int calculate_pressure_threshold(struct zone *zone);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 7ae7a4136855..f1ab251fc2d0 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -49,7 +49,6 @@
#include <linux/limits.h>
#include <linux/dcache.h>
#include <linux/syscalls.h>
-#include <linux/vmstat.h>
#include <linux/nfs_fs.h>
#include <linux/acpi.h>
#include <linux/reboot.h>
@@ -2071,17 +2070,6 @@ static struct ctl_table vm_table[] = {
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_TWO_HUNDRED,
},
-#ifdef CONFIG_NUMA
- {
- .procname = "numa_stat",
- .data = &sysctl_vm_numa_stat,
- .maxlen = sizeof(int),
- .mode = 0644,
- .proc_handler = sysctl_vm_numa_stat_handler,
- .extra1 = SYSCTL_ZERO,
- .extra2 = SYSCTL_ONE,
- },
-#endif
{
.procname = "drop_caches",
.data = &sysctl_drop_caches,
@@ -2147,22 +2135,6 @@ static struct ctl_table vm_table[] = {
.extra1 = SYSCTL_ZERO,
},
#endif
-#ifdef CONFIG_SMP
- {
- .procname = "stat_interval",
- .data = &sysctl_stat_interval,
- .maxlen = sizeof(sysctl_stat_interval),
- .mode = 0644,
- .proc_handler = proc_dointvec_jiffies,
- },
- {
- .procname = "stat_refresh",
- .data = NULL,
- .maxlen = 0,
- .mode = 0600,
- .proc_handler = vmstat_refresh,
- },
-#endif
#ifdef CONFIG_MMU
{
.procname = "mmap_min_addr",
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 16bfe1c694dd..39704b5b17e0 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -31,8 +31,10 @@
#include "internal.h"
+#ifdef CONFIG_PROC_FS
#ifdef CONFIG_NUMA
-int sysctl_vm_numa_stat = ENABLE_NUMA_STAT;
+#define ENABLE_NUMA_STAT 1
+static int sysctl_vm_numa_stat = ENABLE_NUMA_STAT;
/* zero numa counters within a zone */
static void zero_zone_numa_counters(struct zone *zone)
@@ -74,7 +76,7 @@ static void invalid_numa_statistics(void)
static DEFINE_MUTEX(vm_numa_stat_lock);
-int sysctl_vm_numa_stat_handler(const struct ctl_table *table, int write,
+static int sysctl_vm_numa_stat_handler(const struct ctl_table *table, int write,
void *buffer, size_t *length, loff_t *ppos)
{
int ret, oldval;
@@ -102,6 +104,7 @@ int sysctl_vm_numa_stat_handler(const struct ctl_table *table, int write,
return ret;
}
#endif
+#endif /* CONFIG_PROC_FS */
#ifdef CONFIG_VM_EVENT_COUNTERS
DEFINE_PER_CPU(struct vm_event_state, vm_event_states) = {{0}};
@@ -1938,7 +1941,7 @@ static const struct seq_operations vmstat_op = {
#ifdef CONFIG_SMP
static DEFINE_PER_CPU(struct delayed_work, vmstat_work);
-int sysctl_stat_interval __read_mostly = HZ;
+static int sysctl_stat_interval __read_mostly = HZ;
static int vmstat_late_init_done;
#ifdef CONFIG_PROC_FS
@@ -1947,7 +1950,7 @@ static void refresh_vm_stats(struct work_struct *work)
refresh_cpu_vm_stats(true);
}
-int vmstat_refresh(const struct ctl_table *table, int write,
+static int vmstat_refresh(const struct ctl_table *table, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{
long val;
@@ -2196,6 +2199,38 @@ static int __init vmstat_late_init(void)
late_initcall(vmstat_late_init);
#endif
+#ifdef CONFIG_PROC_FS
+static const struct ctl_table vmstat_table[] = {
+#ifdef CONFIG_SMP
+ {
+ .procname = "stat_interval",
+ .data = &sysctl_stat_interval,
+ .maxlen = sizeof(sysctl_stat_interval),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_jiffies,
+ },
+ {
+ .procname = "stat_refresh",
+ .data = NULL,
+ .maxlen = 0,
+ .mode = 0600,
+ .proc_handler = vmstat_refresh,
+ },
+#endif
+#ifdef CONFIG_NUMA
+ {
+ .procname = "numa_stat",
+ .data = &sysctl_vm_numa_stat,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = sysctl_vm_numa_stat_handler,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = SYSCTL_ONE,
+ },
+#endif
+};
+#endif
+
struct workqueue_struct *mm_percpu_wq;
void __init init_mm_internals(void)
@@ -2227,6 +2262,7 @@ void __init init_mm_internals(void)
proc_create_seq("pagetypeinfo", 0400, NULL, &pagetypeinfo_op);
proc_create_seq("vmstat", 0444, NULL, &vmstat_op);
proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op);
+ register_sysctl_init("vm", vmstat_table);
#endif
}
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v5 -next 02/16] mm: filemap: move sysctl to mm/filemap.c
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 01/16] mm: vmstat: move sysctls to mm/vmstat.c Kaixiong Yu
@ 2025-01-11 7:07 ` Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 03/16] mm: swap: move sysctl to mm/swap.c Kaixiong Yu
` (14 subsequent siblings)
16 siblings, 0 replies; 25+ messages in thread
From: Kaixiong Yu @ 2025-01-11 7:07 UTC (permalink / raw)
To: akpm, mcgrof, joel.granados
Cc: ysato, dalias, glaubitz, luto, tglx, mingo, bp, dave.hansen, hpa,
viro, brauner, jack, kees, j.granados, willy, Liam.Howlett,
vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever, jlayton,
neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
paul, jmorris, linux-sh, linux-kernel, linux-fsdevel, linux-mm,
linux-nfs, netdev, linux-security-module, dhowells, haifeng.xu,
baolin.wang, shikemeng, dchinner, bfoster, souravpanda, hannes,
rientjes, pasha.tatashin, david, ryan.roberts, ying.huang, yang,
zev, serge, vegard.nossum, wangkefeng.wang
This moves the filemap related sysctl to mm/filemap.c, and
removes the redundant external variable declaration.
Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
Reviewed-by: Kees Cook <kees@kernel.org>
---
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 <linux/splice.h>
#include <linux/rcupdate_wait.h>
#include <linux/sched/mm.h>
+#include <linux/sysctl.h>
#include <linux/fsnotify.h>
#include <asm/pgalloc.h>
#include <asm/tlbflush.h>
@@ -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)
{
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v5 -next 03/16] mm: swap: move sysctl to mm/swap.c
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 01/16] mm: vmstat: move sysctls to mm/vmstat.c Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 02/16] mm: filemap: move sysctl to mm/filemap.c Kaixiong Yu
@ 2025-01-11 7:07 ` Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 04/16] mm: vmscan: move vmscan sysctls to mm/vmscan.c Kaixiong Yu
` (13 subsequent siblings)
16 siblings, 0 replies; 25+ messages in thread
From: Kaixiong Yu @ 2025-01-11 7:07 UTC (permalink / raw)
To: akpm, mcgrof, joel.granados
Cc: ysato, dalias, glaubitz, luto, tglx, mingo, bp, dave.hansen, hpa,
viro, brauner, jack, kees, j.granados, willy, Liam.Howlett,
vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever, jlayton,
neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
paul, jmorris, linux-sh, linux-kernel, linux-fsdevel, linux-mm,
linux-nfs, netdev, linux-security-module, dhowells, haifeng.xu,
baolin.wang, shikemeng, dchinner, bfoster, souravpanda, hannes,
rientjes, pasha.tatashin, david, ryan.roberts, ying.huang, yang,
zev, serge, vegard.nossum, wangkefeng.wang
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 <yukaixiong@huawei.com>
Reviewed-by: Kees Cook <kees@kernel.org>
---
v4:
- const qualify struct ctl_table swap_sysctl_table
v3:
- change the title
---
---
include/linux/mm.h | 2 --
kernel/sysctl.c | 10 ----------
mm/swap.c | 16 +++++++++++++++-
mm/swap.h | 1 +
4 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index b9a63a6c960f..fb00ee129f77 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -77,8 +77,6 @@ static inline void totalram_pages_add(long count)
}
extern void * high_memory;
-extern int page_cluster;
-extern const int page_cluster_max;
#ifdef CONFIG_SYSCTL
extern int sysctl_legacy_va_layout;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 23c8db80da5d..ab5d94f07e53 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -21,7 +21,6 @@
#include <linux/module.h>
#include <linux/mm.h>
-#include <linux/swap.h>
#include <linux/slab.h>
#include <linux/sysctl.h>
#include <linux/bitmap.h>
@@ -2044,15 +2043,6 @@ static struct ctl_table vm_table[] = {
.mode = 0644,
.proc_handler = overcommit_kbytes_handler,
},
- {
- .procname = "page-cluster",
- .data = &page_cluster,
- .maxlen = sizeof(int),
- .mode = 0644,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO,
- .extra2 = (void *)&page_cluster_max,
- },
{
.procname = "dirtytime_expire_seconds",
.data = &dirtytime_expire_interval,
diff --git a/mm/swap.c b/mm/swap.c
index fc8281ef4241..b81cce146eb2 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -45,7 +45,7 @@
/* How many pages do we try to swap or page in/out together? As a power of 2 */
int page_cluster;
-const int page_cluster_max = 31;
+static const int page_cluster_max = 31;
struct cpu_fbatches {
/*
@@ -1076,6 +1076,18 @@ void folio_batch_remove_exceptionals(struct folio_batch *fbatch)
fbatch->nr = j;
}
+static const struct ctl_table swap_sysctl_table[] = {
+ {
+ .procname = "page-cluster",
+ .data = &page_cluster,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = (void *)&page_cluster_max,
+ }
+};
+
/*
* Perform any setup for the swap system
*/
@@ -1092,4 +1104,6 @@ void __init swap_setup(void)
* Right now other parts of the system means that we
* _really_ don't want to cluster much more
*/
+
+ register_sysctl_init("vm", swap_sysctl_table);
}
diff --git a/mm/swap.h b/mm/swap.h
index ad2f121de970..274dcc6219a0 100644
--- a/mm/swap.h
+++ b/mm/swap.h
@@ -3,6 +3,7 @@
#define _MM_SWAP_H
struct mempolicy;
+extern int page_cluster;
#ifdef CONFIG_SWAP
#include <linux/swapops.h> /* for swp_offset */
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v5 -next 04/16] mm: vmscan: move vmscan sysctls to mm/vmscan.c
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
` (2 preceding siblings ...)
2025-01-11 7:07 ` [PATCH v5 -next 03/16] mm: swap: move sysctl to mm/swap.c Kaixiong Yu
@ 2025-01-11 7:07 ` Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 05/16] mm: util: move sysctls to mm/util.c Kaixiong Yu
` (12 subsequent siblings)
16 siblings, 0 replies; 25+ messages in thread
From: Kaixiong Yu @ 2025-01-11 7:07 UTC (permalink / raw)
To: akpm, mcgrof, joel.granados
Cc: ysato, dalias, glaubitz, luto, tglx, mingo, bp, dave.hansen, hpa,
viro, brauner, jack, kees, j.granados, willy, Liam.Howlett,
vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever, jlayton,
neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
paul, jmorris, linux-sh, linux-kernel, linux-fsdevel, linux-mm,
linux-nfs, netdev, linux-security-module, dhowells, haifeng.xu,
baolin.wang, shikemeng, dchinner, bfoster, souravpanda, hannes,
rientjes, pasha.tatashin, david, ryan.roberts, ying.huang, yang,
zev, serge, vegard.nossum, wangkefeng.wang
This moves vm_swappiness and zone_reclaim_mode to mm/vmscan.c,
as part of the kernel/sysctl.c cleaning, also moves some external
variable declarations and function declarations from include/linux/swap.h
into mm/internal.h.
Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
Reviewed-by: Kees Cook <kees@kernel.org>
---
v4:
- const qualify struct ctl_table vmscan_sysctl_table
v3:
- change the title
---
---
include/linux/swap.h | 9 ---------
kernel/sysctl.c | 19 -------------------
mm/internal.h | 10 ++++++++++
mm/vmscan.c | 23 +++++++++++++++++++++++
4 files changed, 33 insertions(+), 28 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index b13b72645db3..a98c757400fe 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -433,19 +433,10 @@ extern int vm_swappiness;
long remove_mapping(struct address_space *mapping, struct folio *folio);
#ifdef CONFIG_NUMA
-extern int node_reclaim_mode;
extern int sysctl_min_unmapped_ratio;
extern int sysctl_min_slab_ratio;
-#else
-#define node_reclaim_mode 0
#endif
-static inline bool node_reclaim_enabled(void)
-{
- /* Is any node_reclaim_mode bit set? */
- return node_reclaim_mode & (RECLAIM_ZONE|RECLAIM_WRITE|RECLAIM_UNMAP);
-}
-
void check_move_unevictable_folios(struct folio_batch *fbatch);
extern void __meminit kswapd_run(int nid);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index ab5d94f07e53..cb6ca272fe9f 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2051,15 +2051,6 @@ static struct ctl_table vm_table[] = {
.proc_handler = dirtytime_interval_handler,
.extra1 = SYSCTL_ZERO,
},
- {
- .procname = "swappiness",
- .data = &vm_swappiness,
- .maxlen = sizeof(vm_swappiness),
- .mode = 0644,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO,
- .extra2 = SYSCTL_TWO_HUNDRED,
- },
{
.procname = "drop_caches",
.data = &sysctl_drop_caches,
@@ -2107,16 +2098,6 @@ static struct ctl_table vm_table[] = {
.extra1 = SYSCTL_ZERO,
},
#endif
-#ifdef CONFIG_NUMA
- {
- .procname = "zone_reclaim_mode",
- .data = &node_reclaim_mode,
- .maxlen = sizeof(node_reclaim_mode),
- .mode = 0644,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO,
- },
-#endif
#ifdef CONFIG_MMU
{
.procname = "mmap_min_addr",
diff --git a/mm/internal.h b/mm/internal.h
index 109ef30fee11..cdbbe4c215c0 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -1097,9 +1097,13 @@ static inline void mminit_verify_zonelist(void)
#define NODE_RECLAIM_SUCCESS 1
#ifdef CONFIG_NUMA
+extern int node_reclaim_mode;
+
extern int node_reclaim(struct pglist_data *, gfp_t, unsigned int);
extern int find_next_best_node(int node, nodemask_t *used_node_mask);
#else
+#define node_reclaim_mode 0
+
static inline int node_reclaim(struct pglist_data *pgdat, gfp_t mask,
unsigned int order)
{
@@ -1111,6 +1115,12 @@ static inline int find_next_best_node(int node, nodemask_t *used_node_mask)
}
#endif
+static inline bool node_reclaim_enabled(void)
+{
+ /* Is any node_reclaim_mode bit set? */
+ return node_reclaim_mode & (RECLAIM_ZONE|RECLAIM_WRITE|RECLAIM_UNMAP);
+}
+
/*
* mm/memory-failure.c
*/
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 6d06bb40d5ad..f1183519bf41 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -7404,6 +7404,28 @@ void __meminit kswapd_stop(int nid)
pgdat_kswapd_unlock(pgdat);
}
+static const struct ctl_table vmscan_sysctl_table[] = {
+ {
+ .procname = "swappiness",
+ .data = &vm_swappiness,
+ .maxlen = sizeof(vm_swappiness),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = SYSCTL_TWO_HUNDRED,
+ },
+#ifdef CONFIG_NUMA
+ {
+ .procname = "zone_reclaim_mode",
+ .data = &node_reclaim_mode,
+ .maxlen = sizeof(node_reclaim_mode),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ }
+#endif
+};
+
static int __init kswapd_init(void)
{
int nid;
@@ -7411,6 +7433,7 @@ static int __init kswapd_init(void)
swap_setup();
for_each_node_state(nid, N_MEMORY)
kswapd_run(nid);
+ register_sysctl_init("vm", vmscan_sysctl_table);
return 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v5 -next 05/16] mm: util: move sysctls to mm/util.c
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
` (3 preceding siblings ...)
2025-01-11 7:07 ` [PATCH v5 -next 04/16] mm: vmscan: move vmscan sysctls to mm/vmscan.c Kaixiong Yu
@ 2025-01-11 7:07 ` Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 06/16] mm: mmap: move sysctl to mm/mmap.c Kaixiong Yu
` (11 subsequent siblings)
16 siblings, 0 replies; 25+ messages in thread
From: Kaixiong Yu @ 2025-01-11 7:07 UTC (permalink / raw)
To: akpm, mcgrof, joel.granados
Cc: ysato, dalias, glaubitz, luto, tglx, mingo, bp, dave.hansen, hpa,
viro, brauner, jack, kees, j.granados, willy, Liam.Howlett,
vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever, jlayton,
neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
paul, jmorris, linux-sh, linux-kernel, linux-fsdevel, linux-mm,
linux-nfs, netdev, linux-security-module, dhowells, haifeng.xu,
baolin.wang, shikemeng, dchinner, bfoster, souravpanda, hannes,
rientjes, pasha.tatashin, david, ryan.roberts, ying.huang, yang,
zev, serge, vegard.nossum, wangkefeng.wang
This moves all util related sysctls to mm/util.c, as part of the
kernel/sysctl.c cleaning, also removes redundant external
variable declarations and function declarations.
Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
Reviewed-by: Kees Cook <kees@kernel.org>
---
v4:
- const qualify struct ctl_table util_sysctl_table
v3:
- change the title
---
---
include/linux/mm.h | 11 --------
include/linux/mman.h | 2 --
kernel/sysctl.c | 37 ------------------------
mm/util.c | 67 ++++++++++++++++++++++++++++++++++++++------
4 files changed, 59 insertions(+), 58 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index fb00ee129f77..5776bc524087 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -206,17 +206,6 @@ extern int sysctl_max_map_count;
extern unsigned long sysctl_user_reserve_kbytes;
extern unsigned long sysctl_admin_reserve_kbytes;
-extern int sysctl_overcommit_memory;
-extern int sysctl_overcommit_ratio;
-extern unsigned long sysctl_overcommit_kbytes;
-
-int overcommit_ratio_handler(const struct ctl_table *, int, void *, size_t *,
- loff_t *);
-int overcommit_kbytes_handler(const struct ctl_table *, int, void *, size_t *,
- loff_t *);
-int overcommit_policy_handler(const struct ctl_table *, int, void *, size_t *,
- loff_t *);
-
#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
#define folio_page_idx(folio, p) (page_to_pfn(p) - folio_pfn(folio))
diff --git a/include/linux/mman.h b/include/linux/mman.h
index a842783ffa62..bce214fece16 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -59,8 +59,6 @@
| MAP_HUGE_1GB)
extern int sysctl_overcommit_memory;
-extern int sysctl_overcommit_ratio;
-extern unsigned long sysctl_overcommit_kbytes;
extern struct percpu_counter vm_committed_as;
#ifdef CONFIG_SMP
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index cb6ca272fe9f..aea3482106e0 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2020,29 +2020,6 @@ static struct ctl_table kern_table[] = {
};
static struct ctl_table vm_table[] = {
- {
- .procname = "overcommit_memory",
- .data = &sysctl_overcommit_memory,
- .maxlen = sizeof(sysctl_overcommit_memory),
- .mode = 0644,
- .proc_handler = overcommit_policy_handler,
- .extra1 = SYSCTL_ZERO,
- .extra2 = SYSCTL_TWO,
- },
- {
- .procname = "overcommit_ratio",
- .data = &sysctl_overcommit_ratio,
- .maxlen = sizeof(sysctl_overcommit_ratio),
- .mode = 0644,
- .proc_handler = overcommit_ratio_handler,
- },
- {
- .procname = "overcommit_kbytes",
- .data = &sysctl_overcommit_kbytes,
- .maxlen = sizeof(sysctl_overcommit_kbytes),
- .mode = 0644,
- .proc_handler = overcommit_kbytes_handler,
- },
{
.procname = "dirtytime_expire_seconds",
.data = &dirtytime_expire_interval,
@@ -2123,20 +2100,6 @@ static struct ctl_table vm_table[] = {
.extra1 = SYSCTL_ZERO,
},
#endif
- {
- .procname = "user_reserve_kbytes",
- .data = &sysctl_user_reserve_kbytes,
- .maxlen = sizeof(sysctl_user_reserve_kbytes),
- .mode = 0644,
- .proc_handler = proc_doulongvec_minmax,
- },
- {
- .procname = "admin_reserve_kbytes",
- .data = &sysctl_admin_reserve_kbytes,
- .maxlen = sizeof(sysctl_admin_reserve_kbytes),
- .mode = 0644,
- .proc_handler = proc_doulongvec_minmax,
- },
#ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
{
.procname = "mmap_rnd_bits",
diff --git a/mm/util.c b/mm/util.c
index b6b9684a1438..b3480f358d11 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -12,6 +12,7 @@
#include <linux/security.h>
#include <linux/swap.h>
#include <linux/swapops.h>
+#include <linux/sysctl.h>
#include <linux/mman.h>
#include <linux/hugetlb.h>
#include <linux/vmalloc.h>
@@ -906,14 +907,16 @@ int folio_mc_copy(struct folio *dst, struct folio *src)
EXPORT_SYMBOL(folio_mc_copy);
int sysctl_overcommit_memory __read_mostly = OVERCOMMIT_GUESS;
-int sysctl_overcommit_ratio __read_mostly = 50;
-unsigned long sysctl_overcommit_kbytes __read_mostly;
+static int sysctl_overcommit_ratio __read_mostly = 50;
+static unsigned long sysctl_overcommit_kbytes __read_mostly;
int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT;
unsigned long sysctl_user_reserve_kbytes __read_mostly = 1UL << 17; /* 128MB */
unsigned long sysctl_admin_reserve_kbytes __read_mostly = 1UL << 13; /* 8MB */
-int overcommit_ratio_handler(const struct ctl_table *table, int write, void *buffer,
- size_t *lenp, loff_t *ppos)
+#ifdef CONFIG_SYSCTL
+
+static int overcommit_ratio_handler(const struct ctl_table *table, int write,
+ void *buffer, size_t *lenp, loff_t *ppos)
{
int ret;
@@ -928,8 +931,8 @@ static void sync_overcommit_as(struct work_struct *dummy)
percpu_counter_sync(&vm_committed_as);
}
-int overcommit_policy_handler(const struct ctl_table *table, int write, void *buffer,
- size_t *lenp, loff_t *ppos)
+static int overcommit_policy_handler(const struct ctl_table *table, int write,
+ void *buffer, size_t *lenp, loff_t *ppos)
{
struct ctl_table t;
int new_policy = -1;
@@ -964,8 +967,8 @@ int overcommit_policy_handler(const struct ctl_table *table, int write, void *bu
return ret;
}
-int overcommit_kbytes_handler(const struct ctl_table *table, int write, void *buffer,
- size_t *lenp, loff_t *ppos)
+static int overcommit_kbytes_handler(const struct ctl_table *table, int write,
+ void *buffer, size_t *lenp, loff_t *ppos)
{
int ret;
@@ -975,6 +978,54 @@ int overcommit_kbytes_handler(const struct ctl_table *table, int write, void *bu
return ret;
}
+static const struct ctl_table util_sysctl_table[] = {
+ {
+ .procname = "overcommit_memory",
+ .data = &sysctl_overcommit_memory,
+ .maxlen = sizeof(sysctl_overcommit_memory),
+ .mode = 0644,
+ .proc_handler = overcommit_policy_handler,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = SYSCTL_TWO,
+ },
+ {
+ .procname = "overcommit_ratio",
+ .data = &sysctl_overcommit_ratio,
+ .maxlen = sizeof(sysctl_overcommit_ratio),
+ .mode = 0644,
+ .proc_handler = overcommit_ratio_handler,
+ },
+ {
+ .procname = "overcommit_kbytes",
+ .data = &sysctl_overcommit_kbytes,
+ .maxlen = sizeof(sysctl_overcommit_kbytes),
+ .mode = 0644,
+ .proc_handler = overcommit_kbytes_handler,
+ },
+ {
+ .procname = "user_reserve_kbytes",
+ .data = &sysctl_user_reserve_kbytes,
+ .maxlen = sizeof(sysctl_user_reserve_kbytes),
+ .mode = 0644,
+ .proc_handler = proc_doulongvec_minmax,
+ },
+ {
+ .procname = "admin_reserve_kbytes",
+ .data = &sysctl_admin_reserve_kbytes,
+ .maxlen = sizeof(sysctl_admin_reserve_kbytes),
+ .mode = 0644,
+ .proc_handler = proc_doulongvec_minmax,
+ },
+};
+
+static int __init init_vm_util_sysctls(void)
+{
+ register_sysctl_init("vm", util_sysctl_table);
+ return 0;
+}
+subsys_initcall(init_vm_util_sysctls);
+#endif /* CONFIG_SYSCTL */
+
/*
* Committed memory limit enforced when OVERCOMMIT_NEVER policy is used
*/
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v5 -next 06/16] mm: mmap: move sysctl to mm/mmap.c
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
` (4 preceding siblings ...)
2025-01-11 7:07 ` [PATCH v5 -next 05/16] mm: util: move sysctls to mm/util.c Kaixiong Yu
@ 2025-01-11 7:07 ` Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 07/16] security: min_addr: move sysctl to security/min_addr.c Kaixiong Yu
` (10 subsequent siblings)
16 siblings, 0 replies; 25+ messages in thread
From: Kaixiong Yu @ 2025-01-11 7:07 UTC (permalink / raw)
To: akpm, mcgrof, joel.granados
Cc: ysato, dalias, glaubitz, luto, tglx, mingo, bp, dave.hansen, hpa,
viro, brauner, jack, kees, j.granados, willy, Liam.Howlett,
vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever, jlayton,
neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
paul, jmorris, linux-sh, linux-kernel, linux-fsdevel, linux-mm,
linux-nfs, netdev, linux-security-module, dhowells, haifeng.xu,
baolin.wang, shikemeng, dchinner, bfoster, souravpanda, hannes,
rientjes, pasha.tatashin, david, ryan.roberts, ying.huang, yang,
zev, serge, vegard.nossum, wangkefeng.wang
This moves all mmap related sysctls to mm/mmap.c, as part of the
kernel/sysctl.c cleaning, also move the variable declaration from
kernel/sysctl.c into mm/mmap.c.
Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
Reviewed-by: Kees Cook <kees@kernel.org>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
---
v5:
- add Reviewed-by: Lorenzo Stoakes
v4:
- const qualify struct ctl_table mmap_table
v3:
- change the title
v2:
- fix sysctl_max_map_count undeclared issue in mm/nommu.c
---
---
kernel/sysctl.c | 50 +--------------------------------------------
mm/mmap.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 49 deletions(-)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index aea3482106e0..9c245898f535 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -127,12 +127,6 @@ enum sysctl_writes_mode {
static enum sysctl_writes_mode sysctl_writes_strict = SYSCTL_WRITES_STRICT;
#endif /* CONFIG_PROC_SYSCTL */
-
-#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \
- defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT)
-int sysctl_legacy_va_layout;
-#endif
-
#endif /* CONFIG_SYSCTL */
/*
@@ -2037,16 +2031,7 @@ static struct ctl_table vm_table[] = {
.extra1 = SYSCTL_ONE,
.extra2 = SYSCTL_FOUR,
},
-#ifdef CONFIG_MMU
- {
- .procname = "max_map_count",
- .data = &sysctl_max_map_count,
- .maxlen = sizeof(sysctl_max_map_count),
- .mode = 0644,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO,
- },
-#else
+#ifndef CONFIG_MMU
{
.procname = "nr_trim_pages",
.data = &sysctl_nr_trim_pages,
@@ -2064,17 +2049,6 @@ static struct ctl_table vm_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
},
-#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \
- defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT)
- {
- .procname = "legacy_va_layout",
- .data = &sysctl_legacy_va_layout,
- .maxlen = sizeof(sysctl_legacy_va_layout),
- .mode = 0644,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO,
- },
-#endif
#ifdef CONFIG_MMU
{
.procname = "mmap_min_addr",
@@ -2100,28 +2074,6 @@ static struct ctl_table vm_table[] = {
.extra1 = SYSCTL_ZERO,
},
#endif
-#ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
- {
- .procname = "mmap_rnd_bits",
- .data = &mmap_rnd_bits,
- .maxlen = sizeof(mmap_rnd_bits),
- .mode = 0600,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = (void *)&mmap_rnd_bits_min,
- .extra2 = (void *)&mmap_rnd_bits_max,
- },
-#endif
-#ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS
- {
- .procname = "mmap_rnd_compat_bits",
- .data = &mmap_rnd_compat_bits,
- .maxlen = sizeof(mmap_rnd_compat_bits),
- .mode = 0600,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = (void *)&mmap_rnd_compat_bits_min,
- .extra2 = (void *)&mmap_rnd_compat_bits_max,
- },
-#endif
};
int __init sysctl_init_bases(void)
diff --git a/mm/mmap.c b/mm/mmap.c
index 7aa36216ecc0..9b9d7ded839e 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1544,6 +1544,57 @@ struct vm_area_struct *_install_special_mapping(
&special_mapping_vmops);
}
+#ifdef CONFIG_SYSCTL
+#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \
+ defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT)
+int sysctl_legacy_va_layout;
+#endif
+
+static const struct ctl_table mmap_table[] = {
+ {
+ .procname = "max_map_count",
+ .data = &sysctl_max_map_count,
+ .maxlen = sizeof(sysctl_max_map_count),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ },
+#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \
+ defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT)
+ {
+ .procname = "legacy_va_layout",
+ .data = &sysctl_legacy_va_layout,
+ .maxlen = sizeof(sysctl_legacy_va_layout),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ },
+#endif
+#ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
+ {
+ .procname = "mmap_rnd_bits",
+ .data = &mmap_rnd_bits,
+ .maxlen = sizeof(mmap_rnd_bits),
+ .mode = 0600,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = (void *)&mmap_rnd_bits_min,
+ .extra2 = (void *)&mmap_rnd_bits_max,
+ },
+#endif
+#ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS
+ {
+ .procname = "mmap_rnd_compat_bits",
+ .data = &mmap_rnd_compat_bits,
+ .maxlen = sizeof(mmap_rnd_compat_bits),
+ .mode = 0600,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = (void *)&mmap_rnd_compat_bits_min,
+ .extra2 = (void *)&mmap_rnd_compat_bits_max,
+ },
+#endif
+};
+#endif /* CONFIG_SYSCTL */
+
/*
* initialise the percpu counter for VM
*/
@@ -1553,6 +1604,9 @@ void __init mmap_init(void)
ret = percpu_counter_init(&vm_committed_as, 0, GFP_KERNEL);
VM_BUG_ON(ret);
+#ifdef CONFIG_SYSCTL
+ register_sysctl_init("vm", mmap_table);
+#endif
}
/*
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v5 -next 07/16] security: min_addr: move sysctl to security/min_addr.c
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
` (5 preceding siblings ...)
2025-01-11 7:07 ` [PATCH v5 -next 06/16] mm: mmap: move sysctl to mm/mmap.c Kaixiong Yu
@ 2025-01-11 7:07 ` Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 08/16] mm: nommu: move sysctl to mm/nommu.c Kaixiong Yu
` (9 subsequent siblings)
16 siblings, 0 replies; 25+ messages in thread
From: Kaixiong Yu @ 2025-01-11 7:07 UTC (permalink / raw)
To: akpm, mcgrof, joel.granados
Cc: ysato, dalias, glaubitz, luto, tglx, mingo, bp, dave.hansen, hpa,
viro, brauner, jack, kees, j.granados, willy, Liam.Howlett,
vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever, jlayton,
neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
paul, jmorris, linux-sh, linux-kernel, linux-fsdevel, linux-mm,
linux-nfs, netdev, linux-security-module, dhowells, haifeng.xu,
baolin.wang, shikemeng, dchinner, bfoster, souravpanda, hannes,
rientjes, pasha.tatashin, david, ryan.roberts, ying.huang, yang,
zev, serge, vegard.nossum, wangkefeng.wang
The dac_mmap_min_addr belongs to min_addr.c, move it to
min_addr.c from /kernel/sysctl.c. In the previous Linux kernel
boot process, sysctl_init_bases needs to be executed before
init_mmap_min_addr, So, register_sysctl_init should be executed
before update_mmap_min_addr in init_mmap_min_addr. And according
to the compilation condition in security/Makefile:
obj-$(CONFIG_MMU) += min_addr.o
if CONFIG_MMU is not defined, min_addr.c would not be included in the
compilation process. So, drop the CONFIG_MMU check.
Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
Reviewed-by: Kees Cook <kees@kernel.org>
Acked-by: Paul Moore <paul@paul-moore.com>
---
v4:
- const qualify struct ctl_table min_addr_sysctl_table
v3:
- change the title
v2:
- update the changelog to explain why drop CONFIG_MMU check.
---
---
kernel/sysctl.c | 9 ---------
security/min_addr.c | 11 +++++++++++
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 9c245898f535..62a58e417c40 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2049,15 +2049,6 @@ static struct ctl_table vm_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
},
-#ifdef CONFIG_MMU
- {
- .procname = "mmap_min_addr",
- .data = &dac_mmap_min_addr,
- .maxlen = sizeof(unsigned long),
- .mode = 0644,
- .proc_handler = mmap_min_addr_handler,
- },
-#endif
#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
(defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
{
diff --git a/security/min_addr.c b/security/min_addr.c
index 0ce267c041ab..df1bc643d886 100644
--- a/security/min_addr.c
+++ b/security/min_addr.c
@@ -44,8 +44,19 @@ int mmap_min_addr_handler(const struct ctl_table *table, int write,
return ret;
}
+static const struct ctl_table min_addr_sysctl_table[] = {
+ {
+ .procname = "mmap_min_addr",
+ .data = &dac_mmap_min_addr,
+ .maxlen = sizeof(unsigned long),
+ .mode = 0644,
+ .proc_handler = mmap_min_addr_handler,
+ },
+};
+
static int __init init_mmap_min_addr(void)
{
+ register_sysctl_init("vm", min_addr_sysctl_table);
update_mmap_min_addr();
return 0;
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v5 -next 08/16] mm: nommu: move sysctl to mm/nommu.c
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
` (6 preceding siblings ...)
2025-01-11 7:07 ` [PATCH v5 -next 07/16] security: min_addr: move sysctl to security/min_addr.c Kaixiong Yu
@ 2025-01-11 7:07 ` Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 09/16] fs: fs-writeback: move sysctl to fs/fs-writeback.c Kaixiong Yu
` (8 subsequent siblings)
16 siblings, 0 replies; 25+ messages in thread
From: Kaixiong Yu @ 2025-01-11 7:07 UTC (permalink / raw)
To: akpm, mcgrof, joel.granados
Cc: ysato, dalias, glaubitz, luto, tglx, mingo, bp, dave.hansen, hpa,
viro, brauner, jack, kees, j.granados, willy, Liam.Howlett,
vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever, jlayton,
neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
paul, jmorris, linux-sh, linux-kernel, linux-fsdevel, linux-mm,
linux-nfs, netdev, linux-security-module, dhowells, haifeng.xu,
baolin.wang, shikemeng, dchinner, bfoster, souravpanda, hannes,
rientjes, pasha.tatashin, david, ryan.roberts, ying.huang, yang,
zev, serge, vegard.nossum, wangkefeng.wang
The sysctl_nr_trim_pages belongs to nommu.c, move it to mm/nommu.c
from /kernel/sysctl.c. And remove the useless extern variable declaration
from include/linux/mm.h
Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
---
v5:
- add Reviewed-by: Lorenzo Stoakes
v4:
- const qualify struct ctl_table nommu_table
v3:
- change the title
v2:
- fix the build error: expected ';' after top level declarator
- fix the build error: call to undeclared function 'register_syscall_init',
use 'register_sysctl_init' to replace it.
---
---
include/linux/mm.h | 2 --
kernel/sysctl.c | 10 ----------
mm/nommu.c | 15 ++++++++++++++-
3 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 5776bc524087..98654abef3b8 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -4150,8 +4150,6 @@ unsigned long wp_shared_mapping_range(struct address_space *mapping,
pgoff_t first_index, pgoff_t nr);
#endif
-extern int sysctl_nr_trim_pages;
-
#ifdef CONFIG_ANON_VMA_NAME
int madvise_set_anon_name(struct mm_struct *mm, unsigned long start,
unsigned long len_in,
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 62a58e417c40..97f9abffff0f 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2031,16 +2031,6 @@ static struct ctl_table vm_table[] = {
.extra1 = SYSCTL_ONE,
.extra2 = SYSCTL_FOUR,
},
-#ifndef CONFIG_MMU
- {
- .procname = "nr_trim_pages",
- .data = &sysctl_nr_trim_pages,
- .maxlen = sizeof(sysctl_nr_trim_pages),
- .mode = 0644,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO,
- },
-#endif
{
.procname = "vfs_cache_pressure",
.data = &sysctl_vfs_cache_pressure,
diff --git a/mm/nommu.c b/mm/nommu.c
index baa79abdaf03..3c32f8b1eb54 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -48,7 +48,6 @@ struct page *mem_map;
unsigned long max_mapnr;
EXPORT_SYMBOL(max_mapnr);
unsigned long highest_memmap_pfn;
-int sysctl_nr_trim_pages = CONFIG_NOMMU_INITIAL_TRIM_EXCESS;
int heap_stack_gap = 0;
atomic_long_t mmap_pages_allocated;
@@ -392,6 +391,19 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
return mm->brk = brk;
}
+static int sysctl_nr_trim_pages = CONFIG_NOMMU_INITIAL_TRIM_EXCESS;
+
+static const struct ctl_table nommu_table[] = {
+ {
+ .procname = "nr_trim_pages",
+ .data = &sysctl_nr_trim_pages,
+ .maxlen = sizeof(sysctl_nr_trim_pages),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ },
+};
+
/*
* initialise the percpu counter for VM and region record slabs
*/
@@ -402,6 +414,7 @@ void __init mmap_init(void)
ret = percpu_counter_init(&vm_committed_as, 0, GFP_KERNEL);
VM_BUG_ON(ret);
vm_region_jar = KMEM_CACHE(vm_region, SLAB_PANIC|SLAB_ACCOUNT);
+ register_sysctl_init("vm", nommu_table);
}
/*
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v5 -next 09/16] fs: fs-writeback: move sysctl to fs/fs-writeback.c
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
` (7 preceding siblings ...)
2025-01-11 7:07 ` [PATCH v5 -next 08/16] mm: nommu: move sysctl to mm/nommu.c Kaixiong Yu
@ 2025-01-11 7:07 ` Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 10/16] fs: drop_caches: move sysctl to fs/drop_caches.c Kaixiong Yu
` (7 subsequent siblings)
16 siblings, 0 replies; 25+ messages in thread
From: Kaixiong Yu @ 2025-01-11 7:07 UTC (permalink / raw)
To: akpm, mcgrof, joel.granados
Cc: ysato, dalias, glaubitz, luto, tglx, mingo, bp, dave.hansen, hpa,
viro, brauner, jack, kees, j.granados, willy, Liam.Howlett,
vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever, jlayton,
neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
paul, jmorris, linux-sh, linux-kernel, linux-fsdevel, linux-mm,
linux-nfs, netdev, linux-security-module, dhowells, haifeng.xu,
baolin.wang, shikemeng, dchinner, bfoster, souravpanda, hannes,
rientjes, pasha.tatashin, david, ryan.roberts, ying.huang, yang,
zev, serge, vegard.nossum, wangkefeng.wang
The dirtytime_expire_interval belongs to fs/fs-writeback.c, move it to
fs/fs-writeback.c from /kernel/sysctl.c. And remove the useless extern
variable declaration and the function declaration from
include/linux/writeback.h
Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
Reviewed-by: Kees Cook <kees@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
---
v4:
- const qualify struct ctl_table vm_fs_writeback_table
v3:
- change dirtytime_expire_interval to static type
- change the title
---
---
fs/fs-writeback.c | 30 +++++++++++++++++++++---------
include/linux/writeback.h | 4 ----
kernel/sysctl.c | 8 --------
3 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 5980ac24c7a4..4f907e8dbfff 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -65,7 +65,7 @@ struct wb_writeback_work {
* timestamps written to disk after 12 hours, but in the worst case a
* few inodes might not their timestamps updated for 24 hours.
*/
-unsigned int dirtytime_expire_interval = 12 * 60 * 60;
+static unsigned int dirtytime_expire_interval = 12 * 60 * 60;
static inline struct inode *wb_inode(struct list_head *head)
{
@@ -2435,14 +2435,7 @@ static void wakeup_dirtytime_writeback(struct work_struct *w)
schedule_delayed_work(&dirtytime_work, dirtytime_expire_interval * HZ);
}
-static int __init start_dirtytime_writeback(void)
-{
- schedule_delayed_work(&dirtytime_work, dirtytime_expire_interval * HZ);
- return 0;
-}
-__initcall(start_dirtytime_writeback);
-
-int dirtytime_interval_handler(const struct ctl_table *table, int write,
+static int dirtytime_interval_handler(const struct ctl_table *table, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{
int ret;
@@ -2453,6 +2446,25 @@ int dirtytime_interval_handler(const struct ctl_table *table, int write,
return ret;
}
+static const struct ctl_table vm_fs_writeback_table[] = {
+ {
+ .procname = "dirtytime_expire_seconds",
+ .data = &dirtytime_expire_interval,
+ .maxlen = sizeof(dirtytime_expire_interval),
+ .mode = 0644,
+ .proc_handler = dirtytime_interval_handler,
+ .extra1 = SYSCTL_ZERO,
+ },
+};
+
+static int __init start_dirtytime_writeback(void)
+{
+ schedule_delayed_work(&dirtytime_work, dirtytime_expire_interval * HZ);
+ register_sysctl_init("vm", vm_fs_writeback_table);
+ return 0;
+}
+__initcall(start_dirtytime_writeback);
+
/**
* __mark_inode_dirty - internal function to mark an inode dirty
*
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index d11b903c2edb..caf4f0b12235 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -327,12 +327,8 @@ extern struct wb_domain global_wb_domain;
/* These are exported to sysctl. */
extern unsigned int dirty_writeback_interval;
extern unsigned int dirty_expire_interval;
-extern unsigned int dirtytime_expire_interval;
extern int laptop_mode;
-int dirtytime_interval_handler(const struct ctl_table *table, int write,
- void *buffer, size_t *lenp, loff_t *ppos);
-
void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty);
unsigned long wb_calc_thresh(struct bdi_writeback *wb, unsigned long thresh);
unsigned long cgwb_calc_thresh(struct bdi_writeback *wb);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 97f9abffff0f..c5527f59e3f2 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2014,14 +2014,6 @@ static struct ctl_table kern_table[] = {
};
static struct ctl_table vm_table[] = {
- {
- .procname = "dirtytime_expire_seconds",
- .data = &dirtytime_expire_interval,
- .maxlen = sizeof(dirtytime_expire_interval),
- .mode = 0644,
- .proc_handler = dirtytime_interval_handler,
- .extra1 = SYSCTL_ZERO,
- },
{
.procname = "drop_caches",
.data = &sysctl_drop_caches,
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v5 -next 10/16] fs: drop_caches: move sysctl to fs/drop_caches.c
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
` (8 preceding siblings ...)
2025-01-11 7:07 ` [PATCH v5 -next 09/16] fs: fs-writeback: move sysctl to fs/fs-writeback.c Kaixiong Yu
@ 2025-01-11 7:07 ` Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 11/16] sunrpc: simplify rpcauth_cache_shrink_count() Kaixiong Yu
` (6 subsequent siblings)
16 siblings, 0 replies; 25+ messages in thread
From: Kaixiong Yu @ 2025-01-11 7:07 UTC (permalink / raw)
To: akpm, mcgrof, joel.granados
Cc: ysato, dalias, glaubitz, luto, tglx, mingo, bp, dave.hansen, hpa,
viro, brauner, jack, kees, j.granados, willy, Liam.Howlett,
vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever, jlayton,
neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
paul, jmorris, linux-sh, linux-kernel, linux-fsdevel, linux-mm,
linux-nfs, netdev, linux-security-module, dhowells, haifeng.xu,
baolin.wang, shikemeng, dchinner, bfoster, souravpanda, hannes,
rientjes, pasha.tatashin, david, ryan.roberts, ying.huang, yang,
zev, serge, vegard.nossum, wangkefeng.wang
The sysctl_drop_caches to fs/drop_caches.c, move it to
fs/drop_caches.c from /kernel/sysctl.c. And remove the
useless extern variable declaration from include/linux/mm.h
Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
Reviewed-by: Kees Cook <kees@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Christian Brauner <brauner@kernel.org>
---
v4:
- const qualify struct ctl_table drop_caches_table
v3:
- change the title
---
---
fs/drop_caches.c | 23 +++++++++++++++++++++--
include/linux/mm.h | 6 ------
kernel/sysctl.c | 9 ---------
3 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/fs/drop_caches.c b/fs/drop_caches.c
index d45ef541d848..019a8b4eaaf9 100644
--- a/fs/drop_caches.c
+++ b/fs/drop_caches.c
@@ -14,7 +14,7 @@
#include "internal.h"
/* A global variable is a bit ugly, but it keeps the code simple */
-int sysctl_drop_caches;
+static int sysctl_drop_caches;
static void drop_pagecache_sb(struct super_block *sb, void *unused)
{
@@ -48,7 +48,7 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused)
iput(toput_inode);
}
-int drop_caches_sysctl_handler(const struct ctl_table *table, int write,
+static int drop_caches_sysctl_handler(const struct ctl_table *table, int write,
void *buffer, size_t *length, loff_t *ppos)
{
int ret;
@@ -77,3 +77,22 @@ int drop_caches_sysctl_handler(const struct ctl_table *table, int write,
}
return 0;
}
+
+static const struct ctl_table drop_caches_table[] = {
+ {
+ .procname = "drop_caches",
+ .data = &sysctl_drop_caches,
+ .maxlen = sizeof(int),
+ .mode = 0200,
+ .proc_handler = drop_caches_sysctl_handler,
+ .extra1 = SYSCTL_ONE,
+ .extra2 = SYSCTL_FOUR,
+ },
+};
+
+static int __init init_vm_drop_caches_sysctls(void)
+{
+ register_sysctl_init("vm", drop_caches_table);
+ return 0;
+}
+fs_initcall(init_vm_drop_caches_sysctls);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 98654abef3b8..3ed6f2600abd 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -3873,12 +3873,6 @@ static inline int in_gate_area(struct mm_struct *mm, unsigned long addr)
extern bool process_shares_mm(struct task_struct *p, struct mm_struct *mm);
-#ifdef CONFIG_SYSCTL
-extern int sysctl_drop_caches;
-int drop_caches_sysctl_handler(const struct ctl_table *, int, void *, size_t *,
- loff_t *);
-#endif
-
void drop_slab(void);
#ifndef CONFIG_MMU
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index c5527f59e3f2..7fb77cbcc24d 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2014,15 +2014,6 @@ static struct ctl_table kern_table[] = {
};
static struct ctl_table vm_table[] = {
- {
- .procname = "drop_caches",
- .data = &sysctl_drop_caches,
- .maxlen = sizeof(int),
- .mode = 0200,
- .proc_handler = drop_caches_sysctl_handler,
- .extra1 = SYSCTL_ONE,
- .extra2 = SYSCTL_FOUR,
- },
{
.procname = "vfs_cache_pressure",
.data = &sysctl_vfs_cache_pressure,
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v5 -next 11/16] sunrpc: simplify rpcauth_cache_shrink_count()
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
` (9 preceding siblings ...)
2025-01-11 7:07 ` [PATCH v5 -next 10/16] fs: drop_caches: move sysctl to fs/drop_caches.c Kaixiong Yu
@ 2025-01-11 7:07 ` Kaixiong Yu
2025-01-17 9:55 ` Joel Granados
2025-01-11 7:07 ` [PATCH v5 -next 12/16] fs: dcache: move the sysctl to fs/dcache.c Kaixiong Yu
` (5 subsequent siblings)
16 siblings, 1 reply; 25+ messages in thread
From: Kaixiong Yu @ 2025-01-11 7:07 UTC (permalink / raw)
To: akpm, mcgrof, joel.granados
Cc: ysato, dalias, glaubitz, luto, tglx, mingo, bp, dave.hansen, hpa,
viro, brauner, jack, kees, j.granados, willy, Liam.Howlett,
vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever, jlayton,
neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
paul, jmorris, linux-sh, linux-kernel, linux-fsdevel, linux-mm,
linux-nfs, netdev, linux-security-module, dhowells, haifeng.xu,
baolin.wang, shikemeng, dchinner, bfoster, souravpanda, hannes,
rientjes, pasha.tatashin, david, ryan.roberts, ying.huang, yang,
zev, serge, vegard.nossum, wangkefeng.wang
It is inappropriate to use sysctl_vfs_cache_pressure here.
The sysctl is documented as: This percentage value controls
the tendency of the kernel to reclaim the memory which is used
for caching of directory and inode objects.
So, simplify result of rpcauth_cache_shrink_count() to
"return number_cred_unused;".
Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
Reviewed-by: Kees Cook <kees@kernel.org>
Acked-by: Anna Schumaker <anna.schumaker@oracle.com>
Acked-by: Jeff Layton <jlayton@kernel.org>
---
v4:
- Simplify result of rpcauth_cache_shrink_count().
---
---
net/sunrpc/auth.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index 04534ea537c8..5a827afd8e3b 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -489,7 +489,7 @@ static unsigned long
rpcauth_cache_shrink_count(struct shrinker *shrink, struct shrink_control *sc)
{
- return number_cred_unused * sysctl_vfs_cache_pressure / 100;
+ return number_cred_unused;
}
static void
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v5 -next 12/16] fs: dcache: move the sysctl to fs/dcache.c
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
` (10 preceding siblings ...)
2025-01-11 7:07 ` [PATCH v5 -next 11/16] sunrpc: simplify rpcauth_cache_shrink_count() Kaixiong Yu
@ 2025-01-11 7:07 ` Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 13/16] x86: vdso: move the sysctl to arch/x86/entry/vdso/vdso32-setup.c Kaixiong Yu
` (4 subsequent siblings)
16 siblings, 0 replies; 25+ messages in thread
From: Kaixiong Yu @ 2025-01-11 7:07 UTC (permalink / raw)
To: akpm, mcgrof, joel.granados
Cc: ysato, dalias, glaubitz, luto, tglx, mingo, bp, dave.hansen, hpa,
viro, brauner, jack, kees, j.granados, willy, Liam.Howlett,
vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever, jlayton,
neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
paul, jmorris, linux-sh, linux-kernel, linux-fsdevel, linux-mm,
linux-nfs, netdev, linux-security-module, dhowells, haifeng.xu,
baolin.wang, shikemeng, dchinner, bfoster, souravpanda, hannes,
rientjes, pasha.tatashin, david, ryan.roberts, ying.huang, yang,
zev, serge, vegard.nossum, wangkefeng.wang
The sysctl_vfs_cache_pressure belongs to fs/dcache.c, move it to
fs/dcache.c from kernel/sysctl.c. As a part of fs/dcache.c cleaning,
sysctl_vfs_cache_pressure is changed to a static variable, and change
the inline-type function vfs_pressure_ratio() to out-of-inline type,
export vfs_pressure_ratio() with EXPORT_SYMBOL_GPL to be used by other
files. Move the unneeded include(linux/dcache.h).
Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
Reviewed-by: Kees Cook <kees@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Christian Brauner <brauner@kernel.org>
---
v4:
- const qualify struct ctl_table vm_dcache_sysctls
v3:
- change the title
v2:
- update the changelog to call out changing the inline-type function
vfs_pressure_ratio() to out-of-inline type
---
---
fs/dcache.c | 21 +++++++++++++++++++--
include/linux/dcache.h | 7 +------
kernel/sysctl.c | 9 ---------
3 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/fs/dcache.c b/fs/dcache.c
index b4d5e9e1e43d..77ca6e9bb71e 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -73,8 +73,13 @@
* If no ancestor relationship:
* arbitrary, since it's serialized on rename_lock
*/
-int sysctl_vfs_cache_pressure __read_mostly = 100;
-EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure);
+static int sysctl_vfs_cache_pressure __read_mostly = 100;
+
+unsigned long vfs_pressure_ratio(unsigned long val)
+{
+ return mult_frac(val, sysctl_vfs_cache_pressure, 100);
+}
+EXPORT_SYMBOL_GPL(vfs_pressure_ratio);
__cacheline_aligned_in_smp DEFINE_SEQLOCK(rename_lock);
@@ -211,8 +216,20 @@ static struct ctl_table fs_dcache_sysctls[] = {
},
};
+static const struct ctl_table vm_dcache_sysctls[] = {
+ {
+ .procname = "vfs_cache_pressure",
+ .data = &sysctl_vfs_cache_pressure,
+ .maxlen = sizeof(sysctl_vfs_cache_pressure),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ },
+};
+
static int __init init_fs_dcache_sysctls(void)
{
+ register_sysctl_init("vm", vm_dcache_sysctls);
register_sysctl_init("fs", fs_dcache_sysctls);
return 0;
}
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index bff956f7b2b9..c81c2e9e13df 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -508,12 +508,7 @@ static inline int simple_positive(const struct dentry *dentry)
return d_really_is_positive(dentry) && !d_unhashed(dentry);
}
-extern int sysctl_vfs_cache_pressure;
-
-static inline unsigned long vfs_pressure_ratio(unsigned long val)
-{
- return mult_frac(val, sysctl_vfs_cache_pressure, 100);
-}
+unsigned long vfs_pressure_ratio(unsigned long val);
/**
* d_inode - Get the actual inode of this dentry
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 7fb77cbcc24d..860dea8f1587 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -46,7 +46,6 @@
#include <linux/key.h>
#include <linux/times.h>
#include <linux/limits.h>
-#include <linux/dcache.h>
#include <linux/syscalls.h>
#include <linux/nfs_fs.h>
#include <linux/acpi.h>
@@ -2014,14 +2013,6 @@ static struct ctl_table kern_table[] = {
};
static struct ctl_table vm_table[] = {
- {
- .procname = "vfs_cache_pressure",
- .data = &sysctl_vfs_cache_pressure,
- .maxlen = sizeof(sysctl_vfs_cache_pressure),
- .mode = 0644,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO,
- },
#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
(defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
{
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v5 -next 13/16] x86: vdso: move the sysctl to arch/x86/entry/vdso/vdso32-setup.c
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
` (11 preceding siblings ...)
2025-01-11 7:07 ` [PATCH v5 -next 12/16] fs: dcache: move the sysctl to fs/dcache.c Kaixiong Yu
@ 2025-01-11 7:07 ` Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 14/16] sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c Kaixiong Yu
` (3 subsequent siblings)
16 siblings, 0 replies; 25+ messages in thread
From: Kaixiong Yu @ 2025-01-11 7:07 UTC (permalink / raw)
To: akpm, mcgrof, joel.granados
Cc: ysato, dalias, glaubitz, luto, tglx, mingo, bp, dave.hansen, hpa,
viro, brauner, jack, kees, j.granados, willy, Liam.Howlett,
vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever, jlayton,
neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
paul, jmorris, linux-sh, linux-kernel, linux-fsdevel, linux-mm,
linux-nfs, netdev, linux-security-module, dhowells, haifeng.xu,
baolin.wang, shikemeng, dchinner, bfoster, souravpanda, hannes,
rientjes, pasha.tatashin, david, ryan.roberts, ying.huang, yang,
zev, serge, vegard.nossum, wangkefeng.wang
When CONFIG_X86_32 is defined and CONFIG_UML is not defined,
vdso_enabled belongs to arch/x86/entry/vdso/vdso32-setup.c.
So, move it into its own file.
Before this patch, vdso_enabled was allowed to be set to
a value exceeding 1 on x86_32 architecture. After this patch is
applied, vdso_enabled is not permitted to set the value more than 1.
It does not matter, because according to the function load_vdso32(),
only vdso_enabled is set to 1, VDSO would be enabled. Other values
all mean "disabled". The same limitation could be seen in the
function vdso32_setup().
Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
Reviewed-by: Kees Cook <kees@kernel.org>
---
v5:
- Accept Brian Gerst's suggestion to reduce the preprocessor
condition "#elif (defined(CONFIG_X86_32) && !defined(CONFIG_UML))"
v4:
- const qualify struct ctl_table vdso_table
---
---
arch/x86/entry/vdso/vdso32-setup.c | 16 +++++++++++-----
kernel/sysctl.c | 8 +-------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/arch/x86/entry/vdso/vdso32-setup.c b/arch/x86/entry/vdso/vdso32-setup.c
index 76e4e74f35b5..8894013eea1d 100644
--- a/arch/x86/entry/vdso/vdso32-setup.c
+++ b/arch/x86/entry/vdso/vdso32-setup.c
@@ -51,15 +51,17 @@ __setup("vdso32=", vdso32_setup);
__setup_param("vdso=", vdso_setup, vdso32_setup, 0);
#endif
-#ifdef CONFIG_X86_64
#ifdef CONFIG_SYSCTL
-/* Register vsyscall32 into the ABI table */
#include <linux/sysctl.h>
-static struct ctl_table abi_table2[] = {
+static const struct ctl_table vdso_table[] = {
{
+#ifdef CONFIG_X86_64
.procname = "vsyscall32",
+#else
+ .procname = "vdso_enabled",
+#endif
.data = &vdso32_enabled,
.maxlen = sizeof(int),
.mode = 0644,
@@ -71,10 +73,14 @@ static struct ctl_table abi_table2[] = {
static __init int ia32_binfmt_init(void)
{
- register_sysctl("abi", abi_table2);
+#ifdef CONFIG_X86_64
+ /* Register vsyscall32 into the ABI table */
+ register_sysctl("abi", vdso_table);
+#else
+ register_sysctl_init("vm", vdso_table);
+#endif
return 0;
}
__initcall(ia32_binfmt_init);
#endif /* CONFIG_SYSCTL */
-#endif /* CONFIG_X86_64 */
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 860dea8f1587..7ff07b7560b4 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2013,17 +2013,11 @@ static struct ctl_table kern_table[] = {
};
static struct ctl_table vm_table[] = {
-#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
- (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
+#if defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)
{
.procname = "vdso_enabled",
-#ifdef CONFIG_X86_32
- .data = &vdso32_enabled,
- .maxlen = sizeof(vdso32_enabled),
-#else
.data = &vdso_enabled,
.maxlen = sizeof(vdso_enabled),
-#endif
.mode = 0644,
.proc_handler = proc_dointvec,
.extra1 = SYSCTL_ZERO,
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v5 -next 14/16] sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
` (12 preceding siblings ...)
2025-01-11 7:07 ` [PATCH v5 -next 13/16] x86: vdso: move the sysctl to arch/x86/entry/vdso/vdso32-setup.c Kaixiong Yu
@ 2025-01-11 7:07 ` Kaixiong Yu
2025-01-24 3:34 ` Rob Landley
2025-01-11 7:07 ` [PATCH v5 -next 15/16] sysctl: remove the vm_table Kaixiong Yu
` (2 subsequent siblings)
16 siblings, 1 reply; 25+ messages in thread
From: Kaixiong Yu @ 2025-01-11 7:07 UTC (permalink / raw)
To: akpm, mcgrof, joel.granados
Cc: ysato, dalias, glaubitz, luto, tglx, mingo, bp, dave.hansen, hpa,
viro, brauner, jack, kees, j.granados, willy, Liam.Howlett,
vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever, jlayton,
neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
paul, jmorris, linux-sh, linux-kernel, linux-fsdevel, linux-mm,
linux-nfs, netdev, linux-security-module, dhowells, haifeng.xu,
baolin.wang, shikemeng, dchinner, bfoster, souravpanda, hannes,
rientjes, pasha.tatashin, david, ryan.roberts, ying.huang, yang,
zev, serge, vegard.nossum, wangkefeng.wang
When CONFIG_SUPERH and CONFIG_VSYSCALL are defined,
vdso_enabled belongs to arch/sh/kernel/vsyscall/vsyscall.c.
So, move it into its own file. To avoid failure when registering
the vdso_table, move the call to register_sysctl_init() into
its own fs_initcall().
Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
Reviewed-by: Kees Cook <kees@kernel.org>
---
v5:
- fix the error discovered by Geert Uytterhoeven.
Move the call to register_sysctl_init() into
its own fs_initcall() as Geert Uytterhoeven's patch does.
- take the advice of Joel Granados, separating path14 in V4
into patch14 and patch15 in V5. This patch just moves the
vdso_enabled table. The next patch removes the vm_table.
- modify the change log
v4:
- const qualify struct ctl_table vdso_table
v3:
- change the title
---
---
arch/sh/kernel/vsyscall/vsyscall.c | 20 ++++++++++++++++++++
kernel/sysctl.c | 13 +------------
2 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/arch/sh/kernel/vsyscall/vsyscall.c b/arch/sh/kernel/vsyscall/vsyscall.c
index add35c51e017..d80dd92a483a 100644
--- a/arch/sh/kernel/vsyscall/vsyscall.c
+++ b/arch/sh/kernel/vsyscall/vsyscall.c
@@ -14,6 +14,7 @@
#include <linux/module.h>
#include <linux/elf.h>
#include <linux/sched.h>
+#include <linux/sysctl.h>
#include <linux/err.h>
/*
@@ -30,6 +31,17 @@ static int __init vdso_setup(char *s)
}
__setup("vdso=", vdso_setup);
+static const struct ctl_table vdso_table[] = {
+ {
+ .procname = "vdso_enabled",
+ .data = &vdso_enabled,
+ .maxlen = sizeof(vdso_enabled),
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ .extra1 = SYSCTL_ZERO,
+ },
+};
+
/*
* These symbols are defined by vsyscall.o to mark the bounds
* of the ELF DSO images included therein.
@@ -58,6 +70,14 @@ int __init vsyscall_init(void)
return 0;
}
+static int __init vm_sysctl_init(void)
+{
+ register_sysctl_init("vm", vdso_table);
+ return 0;
+}
+
+fs_initcall(vm_sysctl_init);
+
/* Setup a VMA at program startup for the vsyscall page */
int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
{
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 7ff07b7560b4..21c362768358 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2012,18 +2012,7 @@ static struct ctl_table kern_table[] = {
#endif
};
-static struct ctl_table vm_table[] = {
-#if defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)
- {
- .procname = "vdso_enabled",
- .data = &vdso_enabled,
- .maxlen = sizeof(vdso_enabled),
- .mode = 0644,
- .proc_handler = proc_dointvec,
- .extra1 = SYSCTL_ZERO,
- },
-#endif
-};
+static struct ctl_table vm_table[] = {};
int __init sysctl_init_bases(void)
{
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v5 -next 15/16] sysctl: remove the vm_table
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
` (13 preceding siblings ...)
2025-01-11 7:07 ` [PATCH v5 -next 14/16] sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c Kaixiong Yu
@ 2025-01-11 7:07 ` Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 16/16] sysctl: remove unneeded include Kaixiong Yu
2025-01-14 13:50 ` [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Joel Granados
16 siblings, 0 replies; 25+ messages in thread
From: Kaixiong Yu @ 2025-01-11 7:07 UTC (permalink / raw)
To: akpm, mcgrof, joel.granados
Cc: ysato, dalias, glaubitz, luto, tglx, mingo, bp, dave.hansen, hpa,
viro, brauner, jack, kees, j.granados, willy, Liam.Howlett,
vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever, jlayton,
neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
paul, jmorris, linux-sh, linux-kernel, linux-fsdevel, linux-mm,
linux-nfs, netdev, linux-security-module, dhowells, haifeng.xu,
baolin.wang, shikemeng, dchinner, bfoster, souravpanda, hannes,
rientjes, pasha.tatashin, david, ryan.roberts, ying.huang, yang,
zev, serge, vegard.nossum, wangkefeng.wang
After patch1~14 is applied, all sysctls of vm_table
would be moved. So, delete vm_table.
Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
---
v5:
- take the advice of Joel Granados, separating moving the
vdso_enabled table and removing the vm_table into two parts.
This patch removes the vm_table.
---
---
kernel/sysctl.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 21c362768358..cebd0ef5d19d 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2012,12 +2012,9 @@ static struct ctl_table kern_table[] = {
#endif
};
-static struct ctl_table vm_table[] = {};
-
int __init sysctl_init_bases(void)
{
register_sysctl_init("kernel", kern_table);
- register_sysctl_init("vm", vm_table);
return 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v5 -next 16/16] sysctl: remove unneeded include
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
` (14 preceding siblings ...)
2025-01-11 7:07 ` [PATCH v5 -next 15/16] sysctl: remove the vm_table Kaixiong Yu
@ 2025-01-11 7:07 ` Kaixiong Yu
2025-01-13 5:10 ` Kalesh Anakkur Purayil
2025-01-14 13:50 ` [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Joel Granados
16 siblings, 1 reply; 25+ messages in thread
From: Kaixiong Yu @ 2025-01-11 7:07 UTC (permalink / raw)
To: akpm, mcgrof, joel.granados
Cc: ysato, dalias, glaubitz, luto, tglx, mingo, bp, dave.hansen, hpa,
viro, brauner, jack, kees, j.granados, willy, Liam.Howlett,
vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever, jlayton,
neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba, pabeni,
paul, jmorris, linux-sh, linux-kernel, linux-fsdevel, linux-mm,
linux-nfs, netdev, linux-security-module, dhowells, haifeng.xu,
baolin.wang, shikemeng, dchinner, bfoster, souravpanda, hannes,
rientjes, pasha.tatashin, david, ryan.roberts, ying.huang, yang,
zev, serge, vegard.nossum, wangkefeng.wang
Removing unneeded mm includes in kernel/sysctl.c.
Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
Reviewed-by: Kees Cook <kees@kernel.org>
---
kernel/sysctl.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index cebd0ef5d19d..aece984bee19 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -20,8 +20,6 @@
*/
#include <linux/module.h>
-#include <linux/mm.h>
-#include <linux/slab.h>
#include <linux/sysctl.h>
#include <linux/bitmap.h>
#include <linux/signal.h>
@@ -30,7 +28,6 @@
#include <linux/proc_fs.h>
#include <linux/security.h>
#include <linux/ctype.h>
-#include <linux/kmemleak.h>
#include <linux/filter.h>
#include <linux/fs.h>
#include <linux/init.h>
@@ -41,7 +38,6 @@
#include <linux/highuid.h>
#include <linux/writeback.h>
#include <linux/ratelimit.h>
-#include <linux/hugetlb.h>
#include <linux/initrd.h>
#include <linux/key.h>
#include <linux/times.h>
@@ -52,13 +48,11 @@
#include <linux/reboot.h>
#include <linux/ftrace.h>
#include <linux/perf_event.h>
-#include <linux/oom.h>
#include <linux/kmod.h>
#include <linux/capability.h>
#include <linux/binfmts.h>
#include <linux/sched/sysctl.h>
#include <linux/mount.h>
-#include <linux/userfaultfd_k.h>
#include <linux/pid.h>
#include "../lib/kstrtox.h"
--
2.34.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH v5 -next 16/16] sysctl: remove unneeded include
2025-01-11 7:07 ` [PATCH v5 -next 16/16] sysctl: remove unneeded include Kaixiong Yu
@ 2025-01-13 5:10 ` Kalesh Anakkur Purayil
2025-01-13 6:59 ` yukaixiong
0 siblings, 1 reply; 25+ messages in thread
From: Kalesh Anakkur Purayil @ 2025-01-13 5:10 UTC (permalink / raw)
To: Kaixiong Yu
Cc: akpm, mcgrof, joel.granados, ysato, dalias, glaubitz, luto, tglx,
mingo, bp, dave.hansen, hpa, viro, brauner, jack, kees,
j.granados, willy, Liam.Howlett, vbabka, lorenzo.stoakes, trondmy,
anna, chuck.lever, jlayton, neilb, okorniev, Dai.Ngo, tom, davem,
edumazet, kuba, pabeni, paul, jmorris, linux-sh, linux-kernel,
linux-fsdevel, linux-mm, linux-nfs, netdev, linux-security-module,
dhowells, haifeng.xu, baolin.wang, shikemeng, dchinner, bfoster,
souravpanda, hannes, rientjes, pasha.tatashin, david,
ryan.roberts, ying.huang, yang, zev, serge, vegard.nossum,
wangkefeng.wang
[-- Attachment #1: Type: text/plain, Size: 328 bytes --]
On Sat, Jan 11, 2025 at 12:49 PM Kaixiong Yu <yukaixiong@huawei.com> wrote:
>
> Removing unneeded mm includes in kernel/sysctl.c.
>
> Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
> Reviewed-by: Kees Cook <kees@kernel.org>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
--
Regards,
Kalesh AP
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4239 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v5 -next 16/16] sysctl: remove unneeded include
2025-01-13 5:10 ` Kalesh Anakkur Purayil
@ 2025-01-13 6:59 ` yukaixiong
0 siblings, 0 replies; 25+ messages in thread
From: yukaixiong @ 2025-01-13 6:59 UTC (permalink / raw)
To: Kalesh Anakkur Purayil
Cc: akpm, mcgrof, joel.granados, ysato, dalias, glaubitz, luto, tglx,
mingo, bp, dave.hansen, hpa, viro, brauner, jack, kees,
j.granados, willy, Liam.Howlett, vbabka, lorenzo.stoakes, trondmy,
anna, chuck.lever, jlayton, neilb, okorniev, Dai.Ngo, tom, davem,
edumazet, kuba, pabeni, paul, jmorris, linux-sh, linux-kernel,
linux-fsdevel, linux-mm, linux-nfs, netdev, linux-security-module,
dhowells, haifeng.xu, baolin.wang, shikemeng, dchinner, bfoster,
souravpanda, hannes, rientjes, pasha.tatashin, david,
ryan.roberts, ying.huang, yang, zev, serge, vegard.nossum,
wangkefeng.wang
On 2025/1/13 13:10, Kalesh Anakkur Purayil wrote:
> On Sat, Jan 11, 2025 at 12:49 PM Kaixiong Yu <yukaixiong@huawei.com> wrote:
>> Removing unneeded mm includes in kernel/sysctl.c.
>>
>> Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
>> Reviewed-by: Kees Cook <kees@kernel.org>
> Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
>
Thanks for your review!
Best ...
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
` (15 preceding siblings ...)
2025-01-11 7:07 ` [PATCH v5 -next 16/16] sysctl: remove unneeded include Kaixiong Yu
@ 2025-01-14 13:50 ` Joel Granados
2025-01-15 1:53 ` yukaixiong
2025-02-05 12:39 ` Joel Granados
16 siblings, 2 replies; 25+ messages in thread
From: Joel Granados @ 2025-01-14 13:50 UTC (permalink / raw)
To: Kaixiong Yu
Cc: akpm, mcgrof, ysato, dalias, glaubitz, luto, tglx, mingo, bp,
dave.hansen, hpa, viro, brauner, jack, kees, j.granados, willy,
Liam.Howlett, vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever,
jlayton, neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba,
pabeni, paul, jmorris, linux-sh, linux-kernel, linux-fsdevel,
linux-mm, linux-nfs, netdev, linux-security-module, dhowells,
haifeng.xu, baolin.wang, shikemeng, dchinner, bfoster,
souravpanda, hannes, rientjes, pasha.tatashin, david,
ryan.roberts, ying.huang, yang, zev, serge, vegard.nossum,
wangkefeng.wang
On Sat, Jan 11, 2025 at 03:07:35PM +0800, Kaixiong Yu wrote:
> This patch series moves sysctls of vm_table in kernel/sysctl.c to
> places where they actually belong, and do some related code clean-ups.
> After this patch series, all sysctls in vm_table have been moved into its
> own files, meanwhile, delete vm_table.
>
> All the modifications of this patch series base on
> linux-next(tags/next-20250110). To test this patch series, the code was
> compiled with both the CONFIG_SYSCTL enabled and disabled on arm64 and
> x86_64 architectures. After this patch series is applied, all files
> under /proc/sys/vm can be read or written normally.
It is looking good! Here is how I think we should move it upstream:
1. These should queued in for 6.15 instead of the next merge window.
It is too late in the current cycle and if we put it in now, it will
not properly tested in linux-next.
2. I am putting this in sysctl-testing with the expectation of pushing this
up for the 6.15 merge window. Please tell me if you want this to go
through some other tree.
Thx for the contribution
Best
>
> my test steps as below listed:
>
> Step 1: Set CONFIG_SYSCTL to 'n' and compile the Linux kernel on the
> arm64 architecture. The kernel compiles successfully without any errors
> or warnings.
>
...
> mm/swap.c | 16 ++-
> mm/swap.h | 1 +
> mm/util.c | 67 +++++++--
> mm/vmscan.c | 23 +++
> mm/vmstat.c | 44 +++++-
> net/sunrpc/auth.c | 2 +-
> security/min_addr.c | 11 ++
> 23 files changed, 336 insertions(+), 312 deletions(-)
>
> --
> 2.34.1
>
--
Joel Granados
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files
2025-01-14 13:50 ` [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Joel Granados
@ 2025-01-15 1:53 ` yukaixiong
2025-01-16 10:03 ` Joel Granados
2025-02-05 12:39 ` Joel Granados
1 sibling, 1 reply; 25+ messages in thread
From: yukaixiong @ 2025-01-15 1:53 UTC (permalink / raw)
To: Joel Granados
Cc: akpm, mcgrof, ysato, dalias, glaubitz, luto, tglx, mingo, bp,
dave.hansen, hpa, viro, brauner, jack, kees, j.granados, willy,
Liam.Howlett, vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever,
jlayton, neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba,
pabeni, paul, jmorris, linux-sh, linux-kernel, linux-fsdevel,
linux-mm, linux-nfs, netdev, linux-security-module, dhowells,
haifeng.xu, baolin.wang, shikemeng, dchinner, bfoster,
souravpanda, hannes, rientjes, pasha.tatashin, david,
ryan.roberts, ying.huang, yang, zev, serge, vegard.nossum,
wangkefeng.wang
On 2025/1/14 21:50, Joel Granados wrote:
> On Sat, Jan 11, 2025 at 03:07:35PM +0800, Kaixiong Yu wrote:
>> This patch series moves sysctls of vm_table in kernel/sysctl.c to
>> places where they actually belong, and do some related code clean-ups.
>> After this patch series, all sysctls in vm_table have been moved into its
>> own files, meanwhile, delete vm_table.
>>
>> All the modifications of this patch series base on
>> linux-next(tags/next-20250110). To test this patch series, the code was
>> compiled with both the CONFIG_SYSCTL enabled and disabled on arm64 and
>> x86_64 architectures. After this patch series is applied, all files
>> under /proc/sys/vm can be read or written normally.
> It is looking good! Here is how I think we should move it upstream:
>
> 1. These should queued in for 6.15 instead of the next merge window.
> It is too late in the current cycle and if we put it in now, it will
> not properly tested in linux-next.
>
> 2. I am putting this in sysctl-testing with the expectation of pushing this
> up for the 6.15 merge window. Please tell me if you want this to go
> through some other tree.
>
> Thx for the contribution
>
> Best
Thank you! I don't want this to go through some other tree.
Best ...
>> my test steps as below listed:
>>
>> Step 1: Set CONFIG_SYSCTL to 'n' and compile the Linux kernel on the
>> arm64 architecture. The kernel compiles successfully without any errors
>> or warnings.
>>
> ...
>> mm/swap.c | 16 ++-
>> mm/swap.h | 1 +
>> mm/util.c | 67 +++++++--
>> mm/vmscan.c | 23 +++
>> mm/vmstat.c | 44 +++++-
>> net/sunrpc/auth.c | 2 +-
>> security/min_addr.c | 11 ++
>> 23 files changed, 336 insertions(+), 312 deletions(-)
>>
>> --
>> 2.34.1
>>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Re: [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files
2025-01-15 1:53 ` yukaixiong
@ 2025-01-16 10:03 ` Joel Granados
0 siblings, 0 replies; 25+ messages in thread
From: Joel Granados @ 2025-01-16 10:03 UTC (permalink / raw)
To: yukaixiong
Cc: akpm, mcgrof, ysato, dalias, glaubitz, luto, tglx, mingo, bp,
dave.hansen, hpa, viro, brauner, jack, kees, j.granados, willy,
Liam.Howlett, vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever,
jlayton, neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba,
pabeni, paul, jmorris, linux-sh, linux-kernel, linux-fsdevel,
linux-mm, linux-nfs, netdev, linux-security-module, dhowells,
haifeng.xu, baolin.wang, shikemeng, dchinner, bfoster,
souravpanda, hannes, rientjes, pasha.tatashin, david,
ryan.roberts, ying.huang, yang, zev, serge, vegard.nossum,
wangkefeng.wang
On Wed, Jan 15, 2025 at 09:53:53AM +0800, yukaixiong wrote:
>
>
> On 2025/1/14 21:50, Joel Granados wrote:
> > On Sat, Jan 11, 2025 at 03:07:35PM +0800, Kaixiong Yu wrote:
> > > This patch series moves sysctls of vm_table in kernel/sysctl.c to
> > > places where they actually belong, and do some related code clean-ups.
> > > After this patch series, all sysctls in vm_table have been moved into its
> > > own files, meanwhile, delete vm_table.
> > >
> > > All the modifications of this patch series base on
> > > linux-next(tags/next-20250110). To test this patch series, the code was
> > > compiled with both the CONFIG_SYSCTL enabled and disabled on arm64 and
> > > x86_64 architectures. After this patch series is applied, all files
> > > under /proc/sys/vm can be read or written normally.
> > It is looking good! Here is how I think we should move it upstream:
> >
> > 1. These should queued in for 6.15 instead of the next merge window.
> > It is too late in the current cycle and if we put it in now, it will
> > not properly tested in linux-next.
> >
> > 2. I am putting this in sysctl-testing with the expectation of pushing this
> > up for the 6.15 merge window. Please tell me if you want this to go
> > through some other tree.
> >
> > Thx for the contribution
> >
> > Best
>
> Thank you! I don't want this to go through some other tree.
This was more for the mm, net and security maintainers :)
>
> Best ...
> > > my test steps as below listed:
> > >
> > > Step 1: Set CONFIG_SYSCTL to 'n' and compile the Linux kernel on the
> > > arm64 architecture. The kernel compiles successfully without any errors
> > > or warnings.
> > >
> > ...
> > > mm/swap.c | 16 ++-
> > > mm/swap.h | 1 +
> > > mm/util.c | 67 +++++++--
> > > mm/vmscan.c | 23 +++
> > > mm/vmstat.c | 44 +++++-
> > > net/sunrpc/auth.c | 2 +-
> > > security/min_addr.c | 11 ++
> > > 23 files changed, 336 insertions(+), 312 deletions(-)
> > >
> > > --
> > > 2.34.1
> > >
>
--
Joel Granados
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v5 -next 11/16] sunrpc: simplify rpcauth_cache_shrink_count()
2025-01-11 7:07 ` [PATCH v5 -next 11/16] sunrpc: simplify rpcauth_cache_shrink_count() Kaixiong Yu
@ 2025-01-17 9:55 ` Joel Granados
0 siblings, 0 replies; 25+ messages in thread
From: Joel Granados @ 2025-01-17 9:55 UTC (permalink / raw)
To: Kaixiong Yu
Cc: akpm, mcgrof, ysato, dalias, glaubitz, luto, tglx, mingo, bp,
dave.hansen, hpa, viro, brauner, jack, kees, j.granados, willy,
Liam.Howlett, vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever,
jlayton, neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba,
pabeni, paul, jmorris, linux-sh, linux-kernel, linux-fsdevel,
linux-mm, linux-nfs, netdev, linux-security-module, dhowells,
haifeng.xu, baolin.wang, shikemeng, dchinner, bfoster,
souravpanda, hannes, rientjes, pasha.tatashin, david,
ryan.roberts, ying.huang, yang, zev, serge, vegard.nossum,
wangkefeng.wang
On Sat, Jan 11, 2025 at 03:07:46PM +0800, Kaixiong Yu wrote:
> It is inappropriate to use sysctl_vfs_cache_pressure here.
> The sysctl is documented as: This percentage value controls
> the tendency of the kernel to reclaim the memory which is used
> for caching of directory and inode objects.
>
> So, simplify result of rpcauth_cache_shrink_count() to
> "return number_cred_unused;".
>
> Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
> Reviewed-by: Kees Cook <kees@kernel.org>
> Acked-by: Anna Schumaker <anna.schumaker@oracle.com>
> Acked-by: Jeff Layton <jlayton@kernel.org>
> ---
> v4:
> - Simplify result of rpcauth_cache_shrink_count().
> ---
> ---
> net/sunrpc/auth.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
> index 04534ea537c8..5a827afd8e3b 100644
> --- a/net/sunrpc/auth.c
> +++ b/net/sunrpc/auth.c
> @@ -489,7 +489,7 @@ static unsigned long
> rpcauth_cache_shrink_count(struct shrinker *shrink, struct shrink_control *sc)
>
> {
> - return number_cred_unused * sysctl_vfs_cache_pressure / 100;
> + return number_cred_unused;
This one is not related to the "moving sysctls out of kenrel/sysctl.c"
but I'll keep it here because of the Acks received.
> }
>
> static void
> --
> 2.34.1
>
--
Joel Granados
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v5 -next 14/16] sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c
2025-01-11 7:07 ` [PATCH v5 -next 14/16] sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c Kaixiong Yu
@ 2025-01-24 3:34 ` Rob Landley
0 siblings, 0 replies; 25+ messages in thread
From: Rob Landley @ 2025-01-24 3:34 UTC (permalink / raw)
To: Kaixiong Yu, akpm; +Cc: ysato, dalias, glaubitz, linux-sh, serge
On 1/11/25 01:07, Kaixiong Yu wrote:
> When CONFIG_SUPERH and CONFIG_VSYSCALL are defined,
> vdso_enabled belongs to arch/sh/kernel/vsyscall/vsyscall.c.
> So, move it into its own file. To avoid failure when registering
> the vdso_table, move the call to register_sysctl_init() into
> its own fs_initcall().
>
> Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
> Reviewed-by: Kees Cook <kees@kernel.org>
> ---
> v5:
> - fix the error discovered by Geert Uytterhoeven.
> Move the call to register_sysctl_init() into
> its own fs_initcall() as Geert Uytterhoeven's patch does.
> - take the advice of Joel Granados, separating path14 in V4
> into patch14 and patch15 in V5. This patch just moves the
> vdso_enabled table. The next patch removes the vm_table.
> - modify the change log
Speaking of, what would it take to add gettimeofday() and
clock_gettime() vdso functions on superh? I looked into it a few weeks
ago but found the subsystem hard to parse.
Rob
P.S. On j-core we have three memory mapped registers any process can
read, the rtc_nsec, rtc_seclo, and rtc_sechi fields in the AIC structure
at
https://github.com/j-core/jcore-soc/blob/master/targets/boards/turtle_1v1/board.h#L29
(volatile unsigned *hlc = (void *)0xabcd0220, or just x = *(volatile
unsigned *)0xabcd0228; if you're checking before/after nanoseconds for
quick and dirty profiling), which has let us be really lazy but ideally
there would be a proper vdso wrapper, and the with-mmu version is going
to want a little more kernel participation...
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files
2025-01-14 13:50 ` [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Joel Granados
2025-01-15 1:53 ` yukaixiong
@ 2025-02-05 12:39 ` Joel Granados
1 sibling, 0 replies; 25+ messages in thread
From: Joel Granados @ 2025-02-05 12:39 UTC (permalink / raw)
To: Kaixiong Yu
Cc: akpm, mcgrof, ysato, dalias, glaubitz, luto, tglx, mingo, bp,
dave.hansen, hpa, viro, brauner, jack, kees, j.granados, willy,
Liam.Howlett, vbabka, lorenzo.stoakes, trondmy, anna, chuck.lever,
jlayton, neilb, okorniev, Dai.Ngo, tom, davem, edumazet, kuba,
pabeni, paul, jmorris, linux-sh, linux-kernel, linux-fsdevel,
linux-mm, linux-nfs, netdev, linux-security-module, dhowells,
haifeng.xu, baolin.wang, shikemeng, dchinner, bfoster,
souravpanda, hannes, rientjes, pasha.tatashin, david,
ryan.roberts, ying.huang, yang, zev, serge, vegard.nossum,
wangkefeng.wang
On Tue, Jan 14, 2025 at 02:50:12PM +0100, Joel Granados wrote:
> On Sat, Jan 11, 2025 at 03:07:35PM +0800, Kaixiong Yu wrote:
> > This patch series moves sysctls of vm_table in kernel/sysctl.c to
> > places where they actually belong, and do some related code clean-ups.
> > After this patch series, all sysctls in vm_table have been moved into its
> > own files, meanwhile, delete vm_table.
> >
> > All the modifications of this patch series base on
> > linux-next(tags/next-20250110). To test this patch series, the code was
> > compiled with both the CONFIG_SYSCTL enabled and disabled on arm64 and
> > x86_64 architectures. After this patch series is applied, all files
> > under /proc/sys/vm can be read or written normally.
>
> It is looking good! Here is how I think we should move it upstream:
>
> 1. These should queued in for 6.15 instead of the next merge window.
> It is too late in the current cycle and if we put it in now, it will
> not properly tested in linux-next.
>
> 2. I am putting this in sysctl-testing with the expectation of pushing this
> up for the 6.15 merge window. Please tell me if you want this to go
> through some other tree.
I have rebased on top of 6.14-rc1 and sent it out for sysctl-testing
once more. I'll add it to sysctl-next by the end of the week (unless we
see something pop-up in the testing).
Best
>
> Thx for the contribution
>
> Best
> >
> > my test steps as below listed:
> >
> > Step 1: Set CONFIG_SYSCTL to 'n' and compile the Linux kernel on the
> > arm64 architecture. The kernel compiles successfully without any errors
> > or warnings.
> >
> ...
> > mm/swap.c | 16 ++-
> > mm/swap.h | 1 +
> > mm/util.c | 67 +++++++--
> > mm/vmscan.c | 23 +++
> > mm/vmstat.c | 44 +++++-
> > net/sunrpc/auth.c | 2 +-
> > security/min_addr.c | 11 ++
> > 23 files changed, 336 insertions(+), 312 deletions(-)
> >
> > --
> > 2.34.1
> >
>
> --
>
> Joel Granados
--
Joel Granados
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2025-02-05 12:39 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-11 7:07 [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 01/16] mm: vmstat: move sysctls to mm/vmstat.c Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 02/16] mm: filemap: move sysctl to mm/filemap.c Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 03/16] mm: swap: move sysctl to mm/swap.c Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 04/16] mm: vmscan: move vmscan sysctls to mm/vmscan.c Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 05/16] mm: util: move sysctls to mm/util.c Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 06/16] mm: mmap: move sysctl to mm/mmap.c Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 07/16] security: min_addr: move sysctl to security/min_addr.c Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 08/16] mm: nommu: move sysctl to mm/nommu.c Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 09/16] fs: fs-writeback: move sysctl to fs/fs-writeback.c Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 10/16] fs: drop_caches: move sysctl to fs/drop_caches.c Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 11/16] sunrpc: simplify rpcauth_cache_shrink_count() Kaixiong Yu
2025-01-17 9:55 ` Joel Granados
2025-01-11 7:07 ` [PATCH v5 -next 12/16] fs: dcache: move the sysctl to fs/dcache.c Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 13/16] x86: vdso: move the sysctl to arch/x86/entry/vdso/vdso32-setup.c Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 14/16] sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c Kaixiong Yu
2025-01-24 3:34 ` Rob Landley
2025-01-11 7:07 ` [PATCH v5 -next 15/16] sysctl: remove the vm_table Kaixiong Yu
2025-01-11 7:07 ` [PATCH v5 -next 16/16] sysctl: remove unneeded include Kaixiong Yu
2025-01-13 5:10 ` Kalesh Anakkur Purayil
2025-01-13 6:59 ` yukaixiong
2025-01-14 13:50 ` [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Joel Granados
2025-01-15 1:53 ` yukaixiong
2025-01-16 10:03 ` Joel Granados
2025-02-05 12:39 ` Joel Granados
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).