simple_lmk: Thaw victims upon killing them

With freezable cgroups and their recent utilization in Android, it's
possible for some of Simple LMK's victims to be frozen at the time that
they're selected for killing. The forced SIGKILL used for killing
victims can only wake up processes containing TASK_WAKEKILL and/or
TASK_INTERRUPTIBLE, not TASK_UNINTERRUPTIBLE, which is the state used on
frozen tasks. In order to wake frozen tasks from their uninterruptible
slumber so that they can die, we must thaw them. Leaving victims frozen
can otherwise make them take an indefinite amount of time to process our
SIGKILL and thus free memory.

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

@ -248,6 +248,9 @@ static void scan_and_kill(void)
/* Allow the victim to run on any CPU. This won't schedule. */ /* Allow the victim to run on any CPU. This won't schedule. */
set_cpus_allowed_ptr(vtsk, cpu_all_mask); set_cpus_allowed_ptr(vtsk, cpu_all_mask);
/* Signals can't wake frozen tasks; only a thaw operation can */
__thaw_task(vtsk);
/* Finally release the victim's task lock acquired earlier */ /* Finally release the victim's task lock acquired earlier */
task_unlock(vtsk); task_unlock(vtsk);
} }

Loading…
Cancel
Save