Received: by 10.213.65.68 with SMTP id h4csp905868imn; Tue, 27 Mar 2018 10:57:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/KSSHESUEXDGG8fLXuWBtqHxchAhooQ/LFWwFaV8GRaRjsRRyI/RYW7qNtVHn/PTmGuELX X-Received: by 2002:a17:902:d891:: with SMTP id b17-v6mr287662plz.55.1522173423534; Tue, 27 Mar 2018 10:57:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522173423; cv=none; d=google.com; s=arc-20160816; b=g1TWYG5S5katFctkejgPLsdeoeXw8cmFkw4gk9ly8ZByFjwSGlOUtNoRscZaxFXUPp C57P7rV3lwH9yvSsmyCglGvin4uETPPL3Bi+gpfNTAopj9NN5L6pZwMw1h45N8/z6W+7 Zg/IgkaI57603+f0jAp2GSXoA8blcA46MVpIv1LP2yTy8c/zUDROYgWHRiL4zvRXs+wQ mEfB3xV5XBC0Bsgvg7l+tnWs2sQ0cHzCLrPHsWQTRZsUtASAdT+qVJTLBlPNtUaB8wbo AzccAxkKD3aZqw6AOAEnbJ8xeXG3snYbolAzNHIEUqPqUpmCG5GgTRDvN13t6v+ijRI2 +5dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=CnkDmPjOozNKv8m6+FPqn/NCqEI+bWW5iTV15aJUsEU=; b=brCSjAkzCc049ixgOYjCigtdaRY/386UQGliTVd3lRighhoYq1yGmOGWfTXwy+4jGY GmkOjNJj9rRO59sRlOyq6TlQ50tN8s5BQTXwKpPrMdsoCy+umEExR47PsD/Q0R0MKncD tqb+r/KDfqQDXa4FT2JpUanWpgaiqPbFOx9amGStnhyD1rAIU6BdAZ2KsjqGouF0LmJk FJ6b6fVb/o+neSxm1WWy0UY5aILF09CyMBaNmRNkxSzoRSVFxt2tIfPB3t/rHD7fqa4w GETA22DP4OV35DbuKau07zFYnL3H0KKIc+Hsi6kZgU1vnI5eKjei7hzzVHA+1YdT7KrL z5VQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i72si1137149pgd.705.2018.03.27.10.56.48; Tue, 27 Mar 2018 10:57:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752717AbeC0RzB (ORCPT + 99 others); Tue, 27 Mar 2018 13:55:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42974 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753351AbeC0Qba (ORCPT ); Tue, 27 Mar 2018 12:31:30 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6EEC9EC5; Tue, 27 Mar 2018 16:31:29 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Kirill A. Shutemov" , Michal Hocko , Andrew Morton , Linus Torvalds Subject: [PATCH 4.9 27/67] mm/thp: do not wait for lock_page() in deferred_split_scan() Date: Tue, 27 Mar 2018 18:27:19 +0200 Message-Id: <20180327162728.445589081@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162726.702411083@linuxfoundation.org> References: <20180327162726.702411083@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kirill A. Shutemov 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 Acked-by: Michal Hocko Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/huge_memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2279,11 +2279,13 @@ static unsigned long deferred_split_scan 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); }