Skip to content

Commit

Permalink
mm: vmpressure: account allocstalls only on higher pressures
Browse files Browse the repository at this point in the history
At present any vmpressure value is scaled up if the pages are
reclaimed through direct reclaim. This can result in false
vmpressure values. Consider a case where a device is booted up
and most of the memory is occuppied by file pages. kswapd will
make sure that high watermark is maintained. Now when a sudden
huge allocation request comes in, the system will definitely
have to get into direct reclaims. The vmpressures can be very low,
but because of allocstall accounting logic even these low values
will be scaled to values nearing 100. This can resulting in
unnecessary LMK kills for example.

Change-Id: Idd7c6724264ac89f1f68f2e9d70a32390ffca3e5
Signed-off-by: Vinayak Menon <[email protected]>
  • Loading branch information
Vinayak Menon authored and nilac8991 committed Oct 22, 2015
1 parent 77c958f commit 4c46119
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mm/vmpressure.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,12 @@ static unsigned long vmpressure_calc_pressure(unsigned long scanned,
static unsigned long vmpressure_account_stall(unsigned long pressure,
unsigned long stall, unsigned long scanned)
{
unsigned long scale =
((vmpressure_scale_max - pressure) * stall) / scanned;
unsigned long scale;

if (pressure < 70)
return pressure;

scale = ((vmpressure_scale_max - pressure) * stall) / scanned;

return pressure + scale;
}
Expand Down

0 comments on commit 4c46119

Please sign in to comment.