Received: by 10.213.65.68 with SMTP id h4csp884646imn; Tue, 27 Mar 2018 10:33:28 -0700 (PDT) X-Google-Smtp-Source: AIpwx48e2qLiYjnfTlx/qJcoyxiirp3KsJn9iT42Uy+/5RMIT+VYklr/MLBpTXVj2US0FNUNvD8h X-Received: by 2002:a17:902:a60d:: with SMTP id u13-v6mr200199plq.305.1522172008582; Tue, 27 Mar 2018 10:33:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522172008; cv=none; d=google.com; s=arc-20160816; b=UeJ5AviFpWA3f8jpa8VAhjwAYBP0GbvKSBqU2ysSJOIwsRq5huN6gEAQQA6Rg1FrAx 5rI78e7AKkpwbdR67JXs50svPUaLZJZnxqF1VzBpZfUYBb0B7pog70pcYu9XwyCFsBAz Mp1FOuybP6xh+MHhauzsSM+h2gvfDZwhxKN/kPYEdIuMwIN7x/CaG9d2Gfv/9da9DCEA JtKubQl/G3Fn+DZlnfEGgfn7VUfV2rjE/fbk9wmPEYnwGGL4ZdbqnR07YkhU3hy6KFLZ SehHq9HiOZ1DWtV14xGCyNhNxf8leKztMtH1W9bb2fe/HZRFwPdApwVYHy3HGERBJd6j /CUw== 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=FsAtSxSS3cV73QK9XpCHNvYsl49U1BN11rT9CIrywUU=; b=zEOKCN9zCp+FB5H1lBSISfNtyeTmINfusFE/CSg9kLpVtJeUeo13yWaHIJWV7wm8Op jhcSGuXWjIw8r3ZijStafRfZqIl3ru67P4F0E+kdb5ipqUpq+Wg7qL3BCyjMG4k0mXDN iJv8YeXXZwPfvvzN56TtNwiDzVKMj/MiNmpuMcb8FNjA7lzgZcfWFAT82W8iYPZ8g+BK +TD0+uxljuRIjd9ZHEyb8WU5wPjtvssiLaYn+IEdxujYkv4Q3d/eVprmeHxf9aMCdM2+ lWf49qVbb2WMzkRjf+uRjY+oFk2iDc2B1ASX/RNKllrVfsul6gcrxQQIQ0UoXhnzP94m BkTA== 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 o69si1221539pfj.329.2018.03.27.10.33.14; Tue, 27 Mar 2018 10:33:28 -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 S1754612AbeC0Qf4 (ORCPT + 99 others); Tue, 27 Mar 2018 12:35:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45576 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753830AbeC0Qfx (ORCPT ); Tue, 27 Mar 2018 12:35:53 -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 33DFECEC; Tue, 27 Mar 2018 16:35:53 +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.14 050/101] mm/thp: do not wait for lock_page() in deferred_split_scan() Date: Tue, 27 Mar 2018 18:27:22 +0200 Message-Id: <20180327162753.098054548@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162749.993880276@linuxfoundation.org> References: <20180327162749.993880276@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.14-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 @@ -2739,11 +2739,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); }