Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

latencytop: move sysctl to its own file

This moves latencytop sysctl to kernel/latencytop.c

Signed-off-by: liaohua <liaohua4@huawei.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

authored by

liaohua and committed by
Luis Chamberlain
988f11e0 f8b7d2b4

+29 -25
-3
include/linux/latencytop.h
··· 38 38 39 39 void clear_tsk_latency_tracing(struct task_struct *p); 40 40 41 - int sysctl_latencytop(struct ctl_table *table, int write, void *buffer, 42 - size_t *lenp, loff_t *ppos); 43 - 44 41 #else 45 42 46 43 static inline void
+29 -12
kernel/latencytop.c
··· 55 55 #include <linux/sched/stat.h> 56 56 #include <linux/list.h> 57 57 #include <linux/stacktrace.h> 58 + #include <linux/sysctl.h> 58 59 59 60 static DEFINE_RAW_SPINLOCK(latency_lock); 60 61 ··· 63 62 static struct latency_record latency_record[MAXLR]; 64 63 65 64 int latencytop_enabled; 65 + 66 + #ifdef CONFIG_SYSCTL 67 + static int sysctl_latencytop(struct ctl_table *table, int write, void *buffer, 68 + size_t *lenp, loff_t *ppos) 69 + { 70 + int err; 71 + 72 + err = proc_dointvec(table, write, buffer, lenp, ppos); 73 + if (latencytop_enabled) 74 + force_schedstat_enabled(); 75 + 76 + return err; 77 + } 78 + 79 + static struct ctl_table latencytop_sysctl[] = { 80 + { 81 + .procname = "latencytop", 82 + .data = &latencytop_enabled, 83 + .maxlen = sizeof(int), 84 + .mode = 0644, 85 + .proc_handler = sysctl_latencytop, 86 + }, 87 + {} 88 + }; 89 + #endif 66 90 67 91 void clear_tsk_latency_tracing(struct task_struct *p) 68 92 { ··· 292 266 static int __init init_lstats_procfs(void) 293 267 { 294 268 proc_create("latency_stats", 0644, NULL, &lstats_proc_ops); 269 + #ifdef CONFIG_SYSCTL 270 + register_sysctl_init("kernel", latencytop_sysctl); 271 + #endif 295 272 return 0; 296 - } 297 - 298 - int sysctl_latencytop(struct ctl_table *table, int write, void *buffer, 299 - size_t *lenp, loff_t *ppos) 300 - { 301 - int err; 302 - 303 - err = proc_dointvec(table, write, buffer, lenp, ppos); 304 - if (latencytop_enabled) 305 - force_schedstat_enabled(); 306 - 307 - return err; 308 273 } 309 274 device_initcall(init_lstats_procfs);
-10
kernel/sysctl.c
··· 64 64 #include <linux/kexec.h> 65 65 #include <linux/mount.h> 66 66 #include <linux/userfaultfd_k.h> 67 - #include <linux/latencytop.h> 68 67 #include <linux/pid.h> 69 68 70 69 #include "../lib/kstrtox.h" ··· 1621 1622 .proc_handler = proc_dointvec_minmax, 1622 1623 .extra1 = SYSCTL_NEG_ONE, 1623 1624 .extra2 = SYSCTL_ONE, 1624 - }, 1625 - #endif 1626 - #ifdef CONFIG_LATENCYTOP 1627 - { 1628 - .procname = "latencytop", 1629 - .data = &latencytop_enabled, 1630 - .maxlen = sizeof(int), 1631 - .mode = 0644, 1632 - .proc_handler = sysctl_latencytop, 1633 1625 }, 1634 1626 #endif 1635 1627 {