[Intel-gfx] [PATCH] HAX mm: Prevent stalling for lock_page in deferred_split_scan

Chris Wilson chris at chris-wilson.co.uk
Wed Dec 13 15:47:57 UTC 2017


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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 2f2f5e774902..e555a90ad079 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2791,10 +2791,13 @@ 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);
+		if (!trylock_page(page))
+			continue;
+
 		/* split_huge_page() removes page from list on success */
 		if (!split_huge_page(page))
 			split++;
+
 		unlock_page(page);
 		put_page(page);
 	}
-- 
2.15.1



More information about the Intel-gfx mailing list