Skip to content

Commit fa41b90

Browse files
kiryltorvalds
authored andcommitted
mm/thp: do not wait for lock_page() in deferred_split_scan()
deferred_split_scan() gets called from reclaim path. Waiting for page lock may lead to deadlock there. Replace lock_page() with trylock_page() and skip the page if we failed to lock it. We will get to the page on the next scan. Link: http://lkml.kernel.org/r/[email protected] Fixes: 9a98225 ("thp: introduce deferred_split_huge_page()") Signed-off-by: Kirill A. Shutemov <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent fece202 commit fa41b90

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mm/huge_memory.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2783,11 +2783,13 @@ static unsigned long deferred_split_scan(struct shrinker *shrink,
27832783

27842784
list_for_each_safe(pos, next, &list) {
27852785
page = list_entry((void *)pos, struct page, mapping);
2786-
lock_page(page);
2786+
if (!trylock_page(page))
2787+
goto next;
27872788
/* split_huge_page() removes page from list on success */
27882789
if (!split_huge_page(page))
27892790
split++;
27902791
unlock_page(page);
2792+
next:
27912793
put_page(page);
27922794
}
27932795

0 commit comments

Comments
 (0)