posix-timers: Make signal printks conditional
authorThomas Gleixner <tglx@linutronix.de>
Tue, 23 May 2017 21:27:38 +0000 (23:27 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 23 May 2017 21:39:57 +0000 (23:39 +0200)
A recent commit added extra printks for CPU/RT limits. This can result in
excessive spam in dmesg.

Make the printks conditional on print_fatal_signals.

Fixes: e7ea7c9806a2 ("rlimits: Print more information when CPU/RT limits are exceeded")
Reported-by: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Arun Raghavan <arun@arunraghavan.net>
kernel/time/posix-cpu-timers.c

index 1370f067fb51511f26d578cb3954032952a62027..d2a1e6dd02913f4beb58b1d79be12d72761deec3 100644 (file)
@@ -825,8 +825,10 @@ static void check_thread_timers(struct task_struct *tsk,
                         * At the hard limit, we just die.
                         * No need to calculate anything else now.
                         */
-                       pr_info("CPU Watchdog Timeout (hard): %s[%d]\n",
-                               tsk->comm, task_pid_nr(tsk));
+                       if (print_fatal_signals) {
+                               pr_info("CPU Watchdog Timeout (hard): %s[%d]\n",
+                                       tsk->comm, task_pid_nr(tsk));
+                       }
                        __group_send_sig_info(SIGKILL, SEND_SIG_PRIV, tsk);
                        return;
                }
@@ -838,8 +840,10 @@ static void check_thread_timers(struct task_struct *tsk,
                                soft += USEC_PER_SEC;
                                sig->rlim[RLIMIT_RTTIME].rlim_cur = soft;
                        }
-                       pr_info("RT Watchdog Timeout (soft): %s[%d]\n",
-                               tsk->comm, task_pid_nr(tsk));
+                       if (print_fatal_signals) {
+                               pr_info("RT Watchdog Timeout (soft): %s[%d]\n",
+                                       tsk->comm, task_pid_nr(tsk));
+                       }
                        __group_send_sig_info(SIGXCPU, SEND_SIG_PRIV, tsk);
                }
        }
@@ -936,8 +940,10 @@ static void check_process_timers(struct task_struct *tsk,
                         * At the hard limit, we just die.
                         * No need to calculate anything else now.
                         */
-                       pr_info("RT Watchdog Timeout (hard): %s[%d]\n",
-                               tsk->comm, task_pid_nr(tsk));
+                       if (print_fatal_signals) {
+                               pr_info("RT Watchdog Timeout (hard): %s[%d]\n",
+                                       tsk->comm, task_pid_nr(tsk));
+                       }
                        __group_send_sig_info(SIGKILL, SEND_SIG_PRIV, tsk);
                        return;
                }
@@ -945,8 +951,10 @@ static void check_process_timers(struct task_struct *tsk,
                        /*
                         * At the soft limit, send a SIGXCPU every second.
                         */
-                       pr_info("CPU Watchdog Timeout (soft): %s[%d]\n",
-                               tsk->comm, task_pid_nr(tsk));
+                       if (print_fatal_signals) {
+                               pr_info("CPU Watchdog Timeout (soft): %s[%d]\n",
+                                       tsk->comm, task_pid_nr(tsk));
+                       }
                        __group_send_sig_info(SIGXCPU, SEND_SIG_PRIV, tsk);
                        if (soft < hard) {
                                soft++;