From patchwork Mon Feb 24 20:30:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Lespinasse X-Patchwork-Id: 11401503 Return-Path: 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 F178C14BC for ; Mon, 24 Feb 2020 20:31:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B437F20675 for ; Mon, 24 Feb 2020 20:31:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="oIs7+P+S" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B437F20675 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5E4FF6B0088; Mon, 24 Feb 2020 15:31:26 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 594706B0089; Mon, 24 Feb 2020 15:31:26 -0500 (EST) 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 4AB116B008A; Mon, 24 Feb 2020 15:31:26 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0164.hostedemail.com [216.40.44.164]) by kanga.kvack.org (Postfix) with ESMTP id 2CEA46B0088 for ; Mon, 24 Feb 2020 15:31:26 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D1D21181AC9CB for ; Mon, 24 Feb 2020 20:31:25 +0000 (UTC) X-FDA: 76526165730.14.ducks57_29879d02bd206 X-Spam-Summary: 2,0,0,bb558a2f36efc4e8,d41d8cd98f00b204,3ndjuxgykces9nyxr0t11tyr.p1zyv07a-zzx8npx.14t@flex--walken.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1277:1313:1314:1345:1359:1437:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3152:3352:3865:3867:3868:3870:4321:4605:5007:6120:6261:6653:9969:10004:10400:11026:11473:11658:11914:12043:12048:12296:12297:12438:12555:12895:13069:13255:13311:13357:14096:14097:14181:14659:14721:21080:21444:21451:21627:21987:30003:30054:30070,0,RBL:209.85.216.73:@flex--walken.bounces.google.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: ducks57_29879d02bd206 X-Filterd-Recvd-Size: 3986 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Mon, 24 Feb 2020 20:31:25 +0000 (UTC) Received: by mail-pj1-f73.google.com with SMTP id h6so420924pju.3 for ; Mon, 24 Feb 2020 12:31:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=lrkbDX3PGaEETk9qsB7ndFK/yokNwLibdxrLa+tAY54=; b=oIs7+P+SU8So3+a/HerB+ZPSAdKJFQbMZyOlpHfj5m9soL5bm1fYnRcB31c1LzkojU Y3AwgrK5RtT+XzIMeYll8hYPreHuHiIQ7oZh69LYC/+3n5FAlK9gBInkU+x45594sowQ bZHjDrgXBlSAhFx5lAV36zURhXTmBnSwJvQaaWT9gMys1ai7duJfVE3nWeMsI9gAyPpR k0dOePLcamiT5ds3OdaVEFj9AyCq8OCkh2YJCsYu0HsOG89cBMP8h7VKt+TxNxMR/u+g 3Z88DRnePmPTx3+zNlQdyRmDM3iB1sYxLxx/xS/boPeDLSa7DtawJxA6Hk2IT7IdEIrR er1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=lrkbDX3PGaEETk9qsB7ndFK/yokNwLibdxrLa+tAY54=; b=j7N3B1fT6+n0dmeV9WL5g34Ronl7VMCjRhVxt2hYf3IAnu/2zt0F81cM03s/PuxjUH F80cHngYSyyDhcRy3BLTNxg2gd6a5NIA4fmYFD9Tuhv05MIJMKhhyuZAG0K0jQK0ofC8 hwyM7eoJjm/+IxHuyiLjoeOIp98Pe2przIcjM5o8ZjkxoVHzFzzbeSkn8o9mgDuIttPw wnAnx3AgPeqlISYtTwaodrOzTrptYmv0QGhHLiOC2lj3cjC372YEJDt1KK5vnseudt3L pRhsi/i/z3DwY/wTm0H/6Uzh+4/sxRVz1G4pvVvpfeNsHX4d9CB7nPi9OaqGpoJX4G+H wTsQ== X-Gm-Message-State: APjAAAWB+VRUIdLyYj8ZzKc/eVjk6o4SBjCzBEJj23mx6MydFTUdPoSN 6NxlYPjpG7MjEtZzCziaJgstoAog6Qk= X-Google-Smtp-Source: APXvYqyWhgBqeD1URyhzw6LAshJKUsbb3w+JidQXihYVDRxNz5G7L9NMZC3YJQgpBMSZZFut6dmy9cBRKbU= X-Received: by 2002:a63:7013:: with SMTP id l19mr53531024pgc.58.1582576284302; Mon, 24 Feb 2020 12:31:24 -0800 (PST) Date: Mon, 24 Feb 2020 12:30:43 -0800 In-Reply-To: <20200224203057.162467-1-walken@google.com> Message-Id: <20200224203057.162467-11-walken@google.com> Mime-Version: 1.0 References: <20200224203057.162467-1-walken@google.com> X-Mailer: git-send-email 2.25.0.265.gbab2e86ba0-goog Subject: [RFC PATCH 10/24] handle_userfault: use the vmf->range field when dropping mmap_sem From: Michel Lespinasse To: Peter Zijlstra , Andrew Morton , Laurent Dufour , Vlastimil Babka , Matthew Wilcox , "Liam R . Howlett" , Jerome Glisse , Davidlohr Bueso , David Rientjes Cc: linux-mm , Michel Lespinasse 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: Change handle_userfault to drop the proper memory range as indicated in the vmf. Signed-off-by: Michel Lespinasse --- fs/userfaultfd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git fs/userfaultfd.c fs/userfaultfd.c index f38095a7ebcd..2b8ee3eaacd7 100644 --- fs/userfaultfd.c +++ fs/userfaultfd.c @@ -489,7 +489,7 @@ vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason) must_wait = userfaultfd_huge_must_wait(ctx, vmf->vma, vmf->address, vmf->flags, reason); - mm_read_unlock(mm); + mm_read_range_unlock(mm, vmf->range); if (likely(must_wait && !READ_ONCE(ctx->released) && (return_to_userland ? !signal_pending(current) : @@ -543,7 +543,7 @@ vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason) * and there's no need to retake the mmap_sem * in such case. */ - mm_read_lock(mm); + mm_read_range_lock(mm, vmf->range); ret = VM_FAULT_NOPAGE; } }