Skip to content

Commit 01e6aac

Browse files
committed
signal: move show_unhandled_signals sysctl to its own file
The show_unhandled_signals sysctl is the only sysctl for debug left on kernel/sysctl.c. We've been moving the syctls out from kernel/sysctl.c so to help avoid merge conflicts as the shared array gets out of hand. This change incurs simplifies sysctl registration by localizing it where it should go for a penalty in size of increasing the kernel by 23 bytes, we accept this given recent cleanups have actually already saved us 1465 bytes in the prior commits. ./scripts/bloat-o-meter vmlinux.3-remove-dev-table vmlinux.4-remove-debug-table add/remove: 3/1 grow/shrink: 0/1 up/down: 177/-154 (23) Function old new delta signal_debug_table - 128 +128 init_signal_sysctls - 33 +33 __pfx_init_signal_sysctls - 16 +16 sysctl_init_bases 85 59 -26 debug_table 128 - -128 Total: Before=21256967, After=21256990, chg +0.00% Reviewed-by: Joel Granados <j.granados@samsung.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
1 parent 996ef31 commit 01e6aac

2 files changed

Lines changed: 23 additions & 14 deletions

File tree

kernel/signal.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include <linux/posix-timers.h>
4646
#include <linux/cgroup.h>
4747
#include <linux/audit.h>
48+
#include <linux/sysctl.h>
4849

4950
#define CREATE_TRACE_POINTS
5051
#include <trace/events/signal.h>
@@ -4771,6 +4772,28 @@ static inline void siginfo_buildtime_checks(void)
47714772
#endif
47724773
}
47734774

4775+
#if defined(CONFIG_SYSCTL)
4776+
static struct ctl_table signal_debug_table[] = {
4777+
#ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
4778+
{
4779+
.procname = "exception-trace",
4780+
.data = &show_unhandled_signals,
4781+
.maxlen = sizeof(int),
4782+
.mode = 0644,
4783+
.proc_handler = proc_dointvec
4784+
},
4785+
#endif
4786+
{ }
4787+
};
4788+
4789+
static int __init init_signal_sysctls(void)
4790+
{
4791+
register_sysctl_init("debug", signal_debug_table);
4792+
return 0;
4793+
}
4794+
early_initcall(init_signal_sysctls);
4795+
#endif /* CONFIG_SYSCTL */
4796+
47744797
void __init signals_init(void)
47754798
{
47764799
siginfo_buildtime_checks();

kernel/sysctl.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2319,19 +2319,6 @@ static struct ctl_table vm_table[] = {
23192319
{ }
23202320
};
23212321

2322-
static struct ctl_table debug_table[] = {
2323-
#ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
2324-
{
2325-
.procname = "exception-trace",
2326-
.data = &show_unhandled_signals,
2327-
.maxlen = sizeof(int),
2328-
.mode = 0644,
2329-
.proc_handler = proc_dointvec
2330-
},
2331-
#endif
2332-
{ }
2333-
};
2334-
23352322
int __init sysctl_init_bases(void)
23362323
{
23372324
register_sysctl_init("kernel", kern_table);
@@ -2341,7 +2328,6 @@ int __init sysctl_init_bases(void)
23412328
#endif
23422329

23432330
register_sysctl_init("vm", vm_table);
2344-
register_sysctl_init("debug", debug_table);
23452331

23462332
return 0;
23472333
}

0 commit comments

Comments
 (0)