linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Throttle shrinkers harder
@ 2014-04-10  7:05 Chris Wilson
  2014-04-18 19:14 ` Andrew Morton
  0 siblings, 1 reply; 13+ messages in thread
From: Chris Wilson @ 2014-04-10  7:05 UTC (permalink / raw)
  To: linux-mm
  Cc: Rik van Riel, intel-gfx, Dave Chinner, Hugh Dickins,
	Michal Hocko, Mel Gorman, Johannes Weiner, Andrew Morton,
	Glauber Costa

During testing of i915.ko with working texture sets larger than RAM, we
encounter OOM with plenty of memory still trapped within writeback, e.g:

[   42.386039] active_anon:10134 inactive_anon:1900781 isolated_anon:32
 active_file:33 inactive_file:39 isolated_file:0
 unevictable:0 dirty:0 writeback:337627 unstable:0
 free:11985 slab_reclaimable:9458 slab_unreclaimable:23614
 mapped:41 shmem:1560769 pagetables:1276 bounce:0

If we throttle for writeback following shrink_slab, this gives us time
to wait upon the writeback generated by the i915.ko shinker:

[ 4756.750808] active_anon:24386 inactive_anon:900793 isolated_anon:0
 active_file:23 inactive_file:20 isolated_file:0
 unevictable:0 dirty:0 writeback:0 unstable:0
 free:5550 slab_reclaimable:5184 slab_unreclaimable:4888
 mapped:3 shmem:472393 pagetables:1249 bounce:0

(Sadly though the test is still failing.)

Testcase: igt/gem_tiled_swapping
References: https://bugs.freedesktop.org/show_bug.cgi?id=72742
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Rik van Riel <riel@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Dave Chinner <dchinner@redhat.com>
Cc: Glauber Costa <glommer@openvz.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: linux-mm@kvack.org
---
 mm/vmscan.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index a9c74b409681..8c2cb1150d17 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -135,6 +135,10 @@ unsigned long vm_total_pages;	/* The total number of pages which the VM controls
 static LIST_HEAD(shrinker_list);
 static DECLARE_RWSEM(shrinker_rwsem);
 
+static bool throttle_direct_reclaim(gfp_t gfp_mask,
+				    struct zonelist *zonelist,
+				    nodemask_t *nodemask);
+
 #ifdef CONFIG_MEMCG
 static bool global_reclaim(struct scan_control *sc)
 {
@@ -1521,7 +1525,7 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
 	 * of pages under pages flagged for immediate reclaim and stall if any
 	 * are encountered in the nr_immediate check below.
 	 */
-	if (nr_writeback && nr_writeback == nr_taken)
+	if (nr_writeback > nr_taken / 2)
 		zone_set_flag(zone, ZONE_WRITEBACK);
 
 	/*
@@ -2465,6 +2469,12 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
 						WB_REASON_TRY_TO_FREE_PAGES);
 			sc->may_writepage = 1;
 		}
+
+		if (global_reclaim(sc) &&
+		    throttle_direct_reclaim(sc->gfp_mask,
+					    zonelist,
+					    sc->nodemask))
+			aborted_reclaim = true;
 	} while (--sc->priority >= 0 && !aborted_reclaim);
 
 out:
-- 
1.9.1

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-04-28 16:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-10  7:05 [PATCH] mm: Throttle shrinkers harder Chris Wilson
2014-04-18 19:14 ` Andrew Morton
2014-04-22 19:30   ` Daniel Vetter
2014-04-23 21:14     ` Dave Hansen
2014-04-24  5:58       ` Chris Wilson
2014-04-24 15:21         ` Dave Hansen
2014-04-24 15:39           ` Chris Wilson
2014-04-24 22:35             ` Dave Hansen
2014-04-25  7:23               ` Chris Wilson
2014-04-25 17:18                 ` Dave Hansen
2014-04-25 17:56                   ` Dave Hansen
2014-04-26 13:10                   ` Chris Wilson
2014-04-28 16:38                     ` Dave Hansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox