From 4826636dc6dbeacc0293623e6388852f8ae2f9bd 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 12fb352b894c..3b1e5f51c332 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -1018,7 +1018,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())) {