summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorVinayak Menon <vinmenon@codeaurora.org>2015-08-19 16:16:39 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:03:53 -0700
commit910a8bd10838baff2a8894a4e8686a9d3eba5a35 (patch)
treeb159222e751b8aeeee111ee7c376585b5fb828d4 /mm
parente5ce54a9cbc60d691e15e8e72ec310ab99735906 (diff)
mm: vmpressure: account allocstalls only on higher pressures
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 result in unnecessary LMK kills for example. So define a tunable threshold for vmpressure above which the allocstalls will be accounted. CRs-fixed: 893699 Change-Id: Idd7c6724264ac89f1f68f2e9d70a32390ffca3e5 Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/vmpressure.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/mm/vmpressure.c b/mm/vmpressure.c
index b843993a9a7c..75b7ffe9e7a3 100644
--- a/mm/vmpressure.c
+++ b/mm/vmpressure.c
@@ -56,6 +56,11 @@ static unsigned long vmpressure_scale_max = 100;
module_param_named(vmpressure_scale_max, vmpressure_scale_max,
ulong, S_IRUGO | S_IWUSR);
+/* vmpressure values >= this will be scaled based on allocstalls */
+static unsigned long allocstall_threshold = 70;
+module_param_named(allocstall_threshold, allocstall_threshold,
+ ulong, S_IRUGO | S_IWUSR);
+
static struct vmpressure global_vmpressure;
BLOCKING_NOTIFIER_HEAD(vmpressure_notifier);
@@ -165,8 +170,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 < allocstall_threshold)
+ return pressure;
+
+ scale = ((vmpressure_scale_max - pressure) * stall) / scanned;
return pressure + scale;
}