]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
mm/thp: do not wait for lock_page() in deferred_split_scan()
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Thu, 22 Mar 2018 23:17:31 +0000 (16:17 -0700)
committerSeth Forshee <seth.forshee@canonical.com>
Wed, 28 Mar 2018 19:05:57 +0000 (14:05 -0500)
BugLink: http://bugs.launchpad.net/bugs/1759655
commit fa41b900c30b45fab03783724932dc30cd46a6be upstream.

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/20180315150747.31945-1-kirill.shutemov@linux.intel.com
Fixes: 9a982250f773 ("thp: introduce deferred_split_huge_page()")
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
mm/huge_memory.c

index 0e7ded98d114d184877d2fc9bd0f02c3187f2ed5..4ed6c89e95c38743a6df59d6cf5fc1a0f69112cd 100644 (file)
@@ -2791,11 +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))
+                       goto next;
                /* split_huge_page() removes page from list on success */
                if (!split_huge_page(page))
                        split++;
                unlock_page(page);
+next:
                put_page(page);
        }