From 7d96f7bacb758c121a1dc9f93cb32ab94d2b35e9 Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Tue, 26 Sep 2023 19:39:33 -0700 Subject: [PATCH] mm: Always indicate OOM kill progress when Simple LMK is enabled When Simple LMK is enabled, the page allocator slowpath always thinks that no OOM kill progress is made because out_of_memory() returns false. As a result, spurious page allocation failures are observed when memory is low and Simple LMK is killing tasks, simply because the page allocator slowpath doesn't think that any OOM killing is taking place. Fix this by simply making out_of_memory() always return true when Simple LMK is enabled. Signed-off-by: Sultan Alsawaf --- mm/oom_kill.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index c04cec730a76..3374738713a4 100755 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -1052,7 +1052,11 @@ bool out_of_memory(struct oom_control *oc) unsigned long freed = 0; enum oom_constraint constraint = CONSTRAINT_NONE; - if (oom_killer_disabled || IS_ENABLED(CONFIG_ANDROID_SIMPLE_LMK)) + /* Return true since Simple LMK automatically kills in the background */ + if (IS_ENABLED(CONFIG_ANDROID_SIMPLE_LMK)) + return true; + + if (oom_killer_disabled) return false; if (try_online_one_block(numa_node_id())) {