Message ID | 20190923042523.10027-3-peterx@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=YfP3=XS=kvack.org=owner-linux-mm@kernel.org> Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D48C114E5 for <patchwork-linux-mm@patchwork.kernel.org>; Mon, 23 Sep 2019 04:25:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AB07C2087C for <patchwork-linux-mm@patchwork.kernel.org>; Mon, 23 Sep 2019 04:25:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB07C2087C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F17BB6B000E; Mon, 23 Sep 2019 00:25:58 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id EEF526B0010; Mon, 23 Sep 2019 00:25:58 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB7466B0266; Mon, 23 Sep 2019 00:25:58 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0145.hostedemail.com [216.40.44.145]) by kanga.kvack.org (Postfix) with ESMTP id B8FFA6B000E for <linux-mm@kvack.org>; Mon, 23 Sep 2019 00:25:58 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 543E318DD for <linux-mm@kvack.org>; Mon, 23 Sep 2019 04:25:58 +0000 (UTC) X-FDA: 75964897596.09.week96_6e43999ed0e3b X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,peterx@redhat.com,::linux-kernel@vger.kernel.org:david@redhat.com:hughd@google.com:gokhale2@llnl.gov:jglisse@redhat.com:xemul@virtuozzo.com:hannes@cmpxchg.org:peterx@redhat.com:cracauer@cons.org:mcfadden8@llnl.gov:shli@fb.com:aarcange@redhat.com:mike.kravetz@oracle.com:dplotnikov@virtuozzo.com:rppt@linux.vnet.ibm.com:torvalds@linux-foundation.org:mgorman@suse.de:kirill@shutemov.name:dgilbert@redhat.com,RULES_HIT:30054:30070,0,RBL:209.132.183.28:@redhat.com:.lbl8.mailshell.net-62.18.0.0 64.10.201.10,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: week96_6e43999ed0e3b X-Filterd-Recvd-Size: 4236 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by imf03.hostedemail.com (Postfix) with ESMTP for <linux-mm@kvack.org>; Mon, 23 Sep 2019 04:25:57 +0000 (UTC) Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AB4C483F4C for <linux-mm@kvack.org>; Mon, 23 Sep 2019 04:25:56 +0000 (UTC) Received: by mail-pl1-f197.google.com with SMTP id a6so7951511pls.20 for <linux-mm@kvack.org>; Sun, 22 Sep 2019 21:25:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nL20lZzBbwkIGL5V1u5lEN6f2V609pKVyYfWwZ4NMZQ=; b=cNIECzOG6bMUx/e7DEhkWNhvVx5X2utXiJPnsSgBDyvLv6cEDlNmAGPKDfFyRJgB/g CvES45Da+Yj5IVu0AbeFxxBvPlfX7+Vgkuai79sK3b1FD3lDsf9XbXtuqBxjCSOhJJIv 8LhqabHxczW7n47c76QDtG6k6Fyj4PFIdHkn/PSqApJlfKDMb78q4O83xDazi6DULVnQ dbDl9SECRIV+U9YyVejfnG97UzZJ83iishWMHZr3ek+TxySdlKNMXIxCNB1kai2Wp37J QotltR5nYeKQluC3HaOrbnGii+Y3TYgfzi67f2H1VFoKaeBYgXKD/AKJb/ds208i7WLB bcuw== X-Gm-Message-State: APjAAAXQn+Oen+GeNdViLzU9/7g6gb8YSRLbkf4b3whNQJydRDW7eG8m gVdqsWo93+1Xmc7vFnIbXLff7bygOy97xtyKPHvdUxaApDV5g8aGPd3QmL8fVurHjffF29Wm9wT thuOSHXN+udw= X-Received: by 2002:a65:67d4:: with SMTP id b20mr27376187pgs.445.1569212755561; Sun, 22 Sep 2019 21:25:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxuxMhYGvH4EJC3+piC4YcWYwZ7eWeZxL3c1t1HTqZSY/8jbiqPCLTpPP6LH9KEz2RQOBjDg== X-Received: by 2002:a65:67d4:: with SMTP id b20mr27376164pgs.445.1569212755347; Sun, 22 Sep 2019 21:25:55 -0700 (PDT) Received: from xz-x1.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id x20sm11781867pfp.120.2019.09.22.21.25.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Sep 2019 21:25:54 -0700 (PDT) From: Peter Xu <peterx@redhat.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: David Hildenbrand <david@redhat.com>, Hugh Dickins <hughd@google.com>, Maya Gokhale <gokhale2@llnl.gov>, Jerome Glisse <jglisse@redhat.com>, Pavel Emelyanov <xemul@virtuozzo.com>, Johannes Weiner <hannes@cmpxchg.org>, peterx@redhat.com, Martin Cracauer <cracauer@cons.org>, Marty McFadden <mcfadden8@llnl.gov>, Shaohua Li <shli@fb.com>, Andrea Arcangeli <aarcange@redhat.com>, Mike Kravetz <mike.kravetz@oracle.com>, Denis Plotnikov <dplotnikov@virtuozzo.com>, Mike Rapoport <rppt@linux.vnet.ibm.com>, Linus Torvalds <torvalds@linux-foundation.org>, Mel Gorman <mgorman@suse.de>, "Kirill A . Shutemov" <kirill@shutemov.name>, "Dr . David Alan Gilbert" <dgilbert@redhat.com> Subject: [PATCH v4 02/10] mm/gup: Fix __get_user_pages() on fault retry of hugetlb Date: Mon, 23 Sep 2019 12:25:15 +0800 Message-Id: <20190923042523.10027-3-peterx@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190923042523.10027-1-peterx@redhat.com> References: <20190923042523.10027-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
mm: Page fault enhancements
|
expand
|
diff --git a/mm/gup.c b/mm/gup.c index eddbb95dcb8f..e60d32f1674d 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -833,6 +833,16 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, i = follow_hugetlb_page(mm, vma, pages, vmas, &start, &nr_pages, i, gup_flags, locked); + if (locked && *locked == 0) { + /* + * We've got a VM_FAULT_RETRY + * and we've lost mmap_sem. + * We must stop here. + */ + BUG_ON(gup_flags & FOLL_NOWAIT); + BUG_ON(ret != 0); + goto out; + } continue; } }
When follow_hugetlb_page() returns with *locked==0, it means we've got a VM_FAULT_RETRY within the fauling process and we've released the mmap_sem. When that happens, we should stop and bail out. Signed-off-by: Peter Xu <peterx@redhat.com> --- mm/gup.c | 10 ++++++++++ 1 file changed, 10 insertions(+)