simple_lmk: Ratelimit the 'no processes available to kill' message

Under extreme simulated memory pressure, the 'no processes available to
kill' message can be spammed hundreds of thousands of times, which is not
productive. Ratelimit it.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
fourteen
Sultan Alsawaf 2 years ago committed by Jenna
parent 4736a011ba
commit 6434ba1b52
  1. 3
      drivers/android/simple_lmk.c

@ -10,6 +10,7 @@
#include <linux/mm.h>
#include <linux/moduleparam.h>
#include <linux/oom.h>
#include <linux/ratelimit.h>
#include <linux/sort.h>
#include <linux/vmpressure.h>
#include <uapi/linux/sched/types.h>
@ -193,7 +194,7 @@ static void scan_and_kill(void)
/* Populate the victims array with tasks sorted by adj and then size */
pages_found = find_victims(&nr_found);
if (unlikely(!nr_found)) {
pr_err("No processes available to kill!\n");
pr_err_ratelimited("No processes available to kill!\n");
return;
}

Loading…
Cancel
Save