Skip to content

Commit 1186618

Browse files
imtangmengmcgrof
authored andcommitted
kernel/delayacct: move delayacct sysctls to its own file
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty dishes, this makes it very difficult to maintain. To help with this maintenance let's start by moving sysctls to places where they actually belong. The proc sysctl maintainers do not want to know what sysctl knobs you wish to add for your own piece of code, we just care about the core logic. All filesystem syctls now get reviewed by fs folks. This commit follows the commit of fs, move the delayacct sysctl to its own file, kernel/delayacct.c. Signed-off-by: tangmeng <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]>
1 parent 801b501 commit 1186618

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

include/linux/delayacct.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ extern int delayacct_on; /* Delay accounting turned on/off */
6161
extern struct kmem_cache *delayacct_cache;
6262
extern void delayacct_init(void);
6363

64-
extern int sysctl_delayacct(struct ctl_table *table, int write, void *buffer,
65-
size_t *lenp, loff_t *ppos);
66-
6764
extern void __delayacct_tsk_init(struct task_struct *);
6865
extern void __delayacct_tsk_exit(struct task_struct *);
6966
extern void __delayacct_blkio_start(void);

kernel/delayacct.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void delayacct_init(void)
4444
}
4545

4646
#ifdef CONFIG_PROC_SYSCTL
47-
int sysctl_delayacct(struct ctl_table *table, int write, void *buffer,
47+
static int sysctl_delayacct(struct ctl_table *table, int write, void *buffer,
4848
size_t *lenp, loff_t *ppos)
4949
{
5050
int state = delayacct_on;
@@ -63,6 +63,26 @@ int sysctl_delayacct(struct ctl_table *table, int write, void *buffer,
6363
set_delayacct(state);
6464
return err;
6565
}
66+
67+
static struct ctl_table kern_delayacct_table[] = {
68+
{
69+
.procname = "task_delayacct",
70+
.data = NULL,
71+
.maxlen = sizeof(unsigned int),
72+
.mode = 0644,
73+
.proc_handler = sysctl_delayacct,
74+
.extra1 = SYSCTL_ZERO,
75+
.extra2 = SYSCTL_ONE,
76+
},
77+
{ }
78+
};
79+
80+
static __init int kernel_delayacct_sysctls_init(void)
81+
{
82+
register_sysctl_init("kernel", kern_delayacct_table);
83+
return 0;
84+
}
85+
late_initcall(kernel_delayacct_sysctls_init);
6686
#endif
6787

6888
void __delayacct_tsk_init(struct task_struct *tsk)

kernel/sysctl.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
#include <linux/userfaultfd_k.h>
6868
#include <linux/latencytop.h>
6969
#include <linux/pid.h>
70-
#include <linux/delayacct.h>
7170

7271
#include "../lib/kstrtox.h"
7372

@@ -1651,17 +1650,6 @@ int proc_do_static_key(struct ctl_table *table, int write,
16511650
}
16521651

16531652
static struct ctl_table kern_table[] = {
1654-
#ifdef CONFIG_TASK_DELAY_ACCT
1655-
{
1656-
.procname = "task_delayacct",
1657-
.data = NULL,
1658-
.maxlen = sizeof(unsigned int),
1659-
.mode = 0644,
1660-
.proc_handler = sysctl_delayacct,
1661-
.extra1 = SYSCTL_ZERO,
1662-
.extra2 = SYSCTL_ONE,
1663-
},
1664-
#endif /* CONFIG_TASK_DELAY_ACCT */
16651653
#ifdef CONFIG_NUMA_BALANCING
16661654
{
16671655
.procname = "numa_balancing",

0 commit comments

Comments
 (0)