summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/tty/sysrq.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/tty/sysrq.c')
-rw-r--r--kernel/drivers/tty/sysrq.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/kernel/drivers/tty/sysrq.c b/kernel/drivers/tty/sysrq.c
index 9ffdfcf2e..5381a728d 100644
--- a/kernel/drivers/tty/sysrq.c
+++ b/kernel/drivers/tty/sysrq.c
@@ -353,9 +353,18 @@ static struct sysrq_key_op sysrq_term_op = {
static void moom_callback(struct work_struct *ignored)
{
- if (!out_of_memory(node_zonelist(first_memory_node, GFP_KERNEL),
- GFP_KERNEL, 0, NULL, true))
+ const gfp_t gfp_mask = GFP_KERNEL;
+ struct oom_control oc = {
+ .zonelist = node_zonelist(first_memory_node, gfp_mask),
+ .nodemask = NULL,
+ .gfp_mask = gfp_mask,
+ .order = -1,
+ };
+
+ mutex_lock(&oom_lock);
+ if (!out_of_memory(&oc))
pr_info("OOM request ignored because killer is disabled\n");
+ mutex_unlock(&oom_lock);
}
static DECLARE_WORK(moom_work, moom_callback);
@@ -460,6 +469,7 @@ static struct sysrq_key_op *sysrq_key_table[36] = {
/* v: May be registered for frame buffer console restore */
NULL, /* v */
&sysrq_showstate_blocked_op, /* w */
+ /* x: May be registered on mips for TLB dump */
/* x: May be registered on ppc/powerpc for xmon */
/* x: May be registered on sparc64 for global PMU dump */
NULL, /* x */
@@ -985,7 +995,7 @@ static int sysrq_reset_seq_param_set(const char *buffer,
return 0;
}
-static struct kernel_param_ops param_ops_sysrq_reset_seq = {
+static const struct kernel_param_ops param_ops_sysrq_reset_seq = {
.get = param_get_ushort,
.set = sysrq_reset_seq_param_set,
};
@@ -993,6 +1003,10 @@ static struct kernel_param_ops param_ops_sysrq_reset_seq = {
#define param_check_sysrq_reset_seq(name, p) \
__param_check(name, p, unsigned short)
+/*
+ * not really modular, but the easiest way to keep compat with existing
+ * bootargs behaviour is to continue using module_param here.
+ */
module_param_array_named(reset_seq, sysrq_reset_seq, sysrq_reset_seq,
&sysrq_reset_seq_len, 0644);
@@ -1109,4 +1123,4 @@ static int __init sysrq_init(void)
return 0;
}
-module_init(sysrq_init);
+device_initcall(sysrq_init);