Skip to content

Commit

Permalink
lowmemorykiller: avoid false adaptive LMK triggers
Browse files Browse the repository at this point in the history
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. Since vmpressure has improved, reset
shift_adj to avoid false adaptive LMK trigger.

Change-Id: I2d77103d7c8f4d8a66e4652cba78e619a7bcef9a
Signed-off-by: Vinayak Menon <[email protected]>
  • Loading branch information
Vinayak Menon authored and nilac8991 committed Oct 22, 2015
1 parent 6499cbb commit 80d9ce5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion drivers/staging/android/lowmemorykiller.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ int adjust_minadj(short *min_score_adj)
static int lmk_vmpressure_notifier(struct notifier_block *nb,
unsigned long action, void *data)
{
int other_free, other_file;
int other_free = 0, other_file = 0;
unsigned long pressure = action;
int array_size = ARRAY_SIZE(lowmem_adj);

Expand Down Expand Up @@ -235,6 +235,15 @@ static int lmk_vmpressure_notifier(struct notifier_block *nb,
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;
Expand Down

0 comments on commit 80d9ce5

Please sign in to comment.