Skip to content

Commit

Permalink
mm/thp: do not wait for lock_page() in deferred_split_scan()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
kiryl authored and torvalds committed Mar 23, 2018
1 parent fece202 commit fa41b90
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mm/huge_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -2783,11 +2783,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))
goto next;
/* split_huge_page() removes page from list on success */
if (!split_huge_page(page))
split++;
unlock_page(page);
next:
put_page(page);
}

Expand Down

0 comments on commit fa41b90

Please sign in to comment.