Received: by 10.213.65.68 with SMTP id h4csp860563imn; Tue, 27 Mar 2018 10:06:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+4o1CPNnEwWMMdmQ9QUKbSFUiXvgdyCG7SsC6t/AhfqKeQGlohNCIFpRRrkinEE/iaDm2b X-Received: by 10.99.113.83 with SMTP id b19mr85069pgn.167.1522170373886; Tue, 27 Mar 2018 10:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522170373; cv=none; d=google.com; s=arc-20160816; b=S3FErXcW93Rl7B5OHKD0Sw9UIv5g0yKYHL4pwUSFm2CJ4LVRtZhzPH3QZQ6miRTtNi nUTQu+n13vWkPSCxcEtCV6Hs38Fb1UxpluE1taUoMfP5beSxDqecfSz64XE9kNF1aXkX uJqxcCv0d5XUQH0BR80pha2/ZZIm4BFZivZmivZFo7vtmyWJomgddH9uMWUKlwSSbyEr YDpzvXT55obm9Agpq3B6gW38ylN3KCTa1QWq1gL0X7kOY2UkUbW2FyV2hm0LjxdEIXf4 Hv67u9HqMEwBE/qQHZ9Z9CB9NCmxo5Mfqjo5jrCqqG9bHbvNhz4M+4dz3uR7soKdD4/H NjdA== 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=PJEpd8jQ5VBP0dUagOq+xOjbH44RtDV4uYiCXjcS2Os=; b=ik4KP7CsTO/LcDMstXBEl5E6lkeO0VeUX+zPFnT5X6rekZcCgmy+woYGiC9g92sDUK auS7ZQSKYcA5SmGaLuumHNwyqzayDSAikpL2PBUHFytteKtdBiqo+gCM9s++VOZ0hvqF LLaf8gvt3Ux8o3ayas8z8tYRxxmRxOXRh1W4G2fq/5JWxOVuVV8eWKO/9Tk800JTJpnu hlF5ru6DwbYceU31kRTcy5StChOUpii2rJ8Iywh9yxfdXyq9jPCDFuKat1UPsdjc3R+U lKvvR4+pubF287npWas4WPBCY/tSfoGpcv9LewAUq6mUV9DG6tVYSvhxJqJjjqyc3Tc2 6Frg== 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 l69si1232558pfk.180.2018.03.27.10.05.59; Tue, 27 Mar 2018 10:06:13 -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 S1755498AbeC0Qkp (ORCPT + 99 others); Tue, 27 Mar 2018 12:40:45 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47852 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755091AbeC0Qkm (ORCPT ); Tue, 27 Mar 2018 12:40:42 -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 A31F61282; Tue, 27 Mar 2018 16:40:41 +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.15 052/105] mm/thp: do not wait for lock_page() in deferred_split_scan() Date: Tue, 27 Mar 2018 18:27:32 +0200 Message-Id: <20180327162800.587962167@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162757.813009222@linuxfoundation.org> References: <20180327162757.813009222@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.15-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 @@ -2791,11 +2791,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); }