[rh7,7/7] mm/vmscan: call wait_iff_congested() only if we have troubles in recaliming

Submitted by Andrey Ryabinin on Jan. 26, 2018, 12:34 p.m.

Details

Message ID 20180126123454.9786-7-aryabinin@virtuozzo.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Andrey Ryabinin Jan. 26, 2018, 12:34 p.m.
Even if zone congested it might be better to continue reclaim as we
may allocate memory from another zone. So call in wait_iff_congested()
only if we have troubles in reclaiming memory.

https://jira.sw.ru/browse/PSBM-61409
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 mm/vmscan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/mm/vmscan.c b/mm/vmscan.c
index d71fa15a1750..4922f734cdb4 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2481,7 +2481,8 @@  static void shrink_zone(struct zone *zone, struct scan_control *sc,
 		 * is congested. Allow kswapd to continue until it starts encountering
 		 * unqueued dirty pages or cycling through the LRU too quickly.
 		 */
-		if (!sc->hibernation_mode && !current_is_kswapd())
+		if (sc->priority < (DEF_PRIORITY - 2) && !sc->hibernation_mode &&
+		    !current_is_kswapd())
 			wait_iff_congested(zone, BLK_RW_ASYNC, HZ/10);
 
 		if (reclaim_state) {