[PATCH 36/66] HAX mm: Prevent stalling for lock_page in deferred_split_scan

Chris Wilson chris at chris-wilson.co.uk
Sat Jan 20 19:43:58 UTC 2018


References: https://bugs.freedesktop.org/show_bug.cgi?id=104009

Suggest-Cc: Kirill A. Shutemov <kirill.shutemov at linux.intel.com>
Suggest-Cc: Vlastimil Babka <vbabka at suse.cz>
Suggest-Cc: Jerome Marchand <jmarchan at redhat.com>
Suggest-Cc: Andrea Arcangeli <aarcange at redhat.com>
Suggest-Cc: Hugh Dickins <hughd at google.com>
Suggest-Cc: Dave Hansen <dave.hansen at intel.com>
Suggest-Cc: Mel Gorman <mgorman at suse.de>
Suggest-Cc: Rik van Riel <riel at redhat.com>
Suggest-Cc: Johannes Weiner <hannes at cmpxchg.org>
Suggest-Cc: Michal Hocko <mhocko at suse.cz>
Suggest-Cc: Christoph Lameter <cl at linux.com>
Suggest-Cc: David Rientjes <rientjes at google.com>
Suggest-Cc: Andrew Morton <akpm at linux-foundation.org>
---
 mm/huge_memory.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 0e7ded98d114..53de14acbbf8 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2791,11 +2791,15 @@ static unsigned long deferred_split_scan(struct shrinker *shrink,
 
 	list_for_each_safe(pos, next, &list) {
 		page = list_entry((void *)pos, struct page, mapping);
-		lock_page(page);
+
 		/* split_huge_page() removes page from list on success */
-		if (!split_huge_page(page))
-			split++;
-		unlock_page(page);
+		if (trylock_page(page)) {
+			if (!split_huge_page(page))
+				split++;
+
+			unlock_page(page);
+		}
+
 		put_page(page);
 	}
 
-- 
2.15.1



More information about the Intel-gfx-trybot mailing list