summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVinayak Menon <vinmenon@codeaurora.org>2015-08-19 16:11:04 +0530
committerJeevan Shriram <jshriram@codeaurora.org>2016-04-13 11:11:20 -0700
commit59a8d2507c667b6973135d882278a119dca09454 (patch)
tree814935c1464b02f31d025d012b888f8e1307e8cc
parentef5918f6805d51d9249a59ab6eead53db3e91327 (diff)
lowmemorykiller: avoid false adaptive LMK triggers
In vmpressure notifier of LMK, shift_adj would have been set by a previous invocation of notifier, which is not followed by a lowmem_shrink yet. If this is follwed by a lower vmpressure, and then by a lowmem_shrink, ALMK still triggers because of the previous higher vmpressure notification. This is wrong. Since vmpressure has improved, reset shift_adj to avoid false adaptive LMK trigger. CRs-fixed: 893699 Change-Id: I2d77103d7c8f4d8a66e4652cba78e619a7bcef9a Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
-rw-r--r--drivers/staging/android/lowmemorykiller.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index d840a4544629..72e1d437fd1b 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -175,6 +175,15 @@ static int lmk_vmpressure_notifier(struct notifier_block *nb,
atomic_set(&shift_adj, 1);
trace_almk_vmpressure(pressure, other_free, other_file);
}
+ } else if (atomic_read(&shift_adj)) {
+ /*
+ * shift_adj would have been set by a previous invocation
+ * of notifier, which is not followed by a lowmem_shrink yet.
+ * Since vmpressure has improved, reset shift_adj to avoid
+ * false adaptive LMK trigger.
+ */
+ trace_almk_vmpressure(pressure, other_free, other_file);
+ atomic_set(&shift_adj, 0);
}
return 0;