mm: ignore the boosting of watermark under lowmemory
When low on free memory and a fragmentation event at the same time will cause the zone watermarks to be offsetted by watermark_boost which in default is 150% of high watermark. The side effects of this is the time taken by the reclaim to reach that level and thus the subsequent reset of the watermark_boost can be higher and hence killing of the FG tasks can happen in that time frame despite the free memory is above zone->_watermark[WMARK_HIGH]. Ignore boosting of watermark under this condition and thus we can create more memory headroom. Change-Id: Ia1fa5d766eee851ad3456f41b4b2d623cf4eeee3 Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
This commit is contained in:
parent
4b832ee13f
commit
feeb6c80da
@ -2224,11 +2224,37 @@ static bool can_steal_fallback(unsigned int order, int start_mt)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool boost_eligible(struct zone *z)
|
||||
{
|
||||
unsigned long high_wmark, threshold;
|
||||
unsigned long reclaim_eligible, free_pages;
|
||||
|
||||
high_wmark = z->_watermark[WMARK_HIGH];
|
||||
reclaim_eligible = zone_page_state_snapshot(z, NR_ZONE_INACTIVE_FILE) +
|
||||
zone_page_state_snapshot(z, NR_ZONE_ACTIVE_FILE);
|
||||
free_pages = zone_page_state(z, NR_FREE_PAGES);
|
||||
threshold = high_wmark + (2 * mult_frac(high_wmark,
|
||||
watermark_boost_factor, 10000));
|
||||
|
||||
/*
|
||||
* Don't boost watermark If we are already low on memory where the
|
||||
* boosting can simply put the watermarks at higher levels for a
|
||||
* longer duration of time and thus the other users relied on the
|
||||
* watermarks are forced to choose unintended decissions. If memory
|
||||
* is so low, kswapd in normal mode should help.
|
||||
*/
|
||||
|
||||
if (reclaim_eligible < threshold && free_pages < threshold)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void boost_watermark(struct zone *zone)
|
||||
{
|
||||
unsigned long max_boost;
|
||||
|
||||
if (!watermark_boost_factor)
|
||||
if (!watermark_boost_factor || !boost_eligible(zone))
|
||||
return;
|
||||
|
||||
max_boost = mult_frac(zone->_watermark[WMARK_HIGH],
|
||||
|
Loading…
Reference in New Issue
Block a user