From patchwork Mon Feb 24 20:30:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Lespinasse X-Patchwork-Id: 11401519 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 96207924 for ; Mon, 24 Feb 2020 20:31:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 642C920675 for ; Mon, 24 Feb 2020 20:31:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="e8qyfBn+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 642C920675 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 0E0B26B00A1; Mon, 24 Feb 2020 15:31:46 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F0C0D6B00A3; Mon, 24 Feb 2020 15:31:45 -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 DFB5A6B00A4; Mon, 24 Feb 2020 15:31:45 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0156.hostedemail.com [216.40.44.156]) by kanga.kvack.org (Postfix) with ESMTP id C00F06B00A1 for ; Mon, 24 Feb 2020 15:31:45 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 83B66180AD811 for ; Mon, 24 Feb 2020 20:31:45 +0000 (UTC) X-FDA: 76526166570.10.love52_2c653666b0f4f X-Spam-Summary: 2,0,0,4078289c69d32df8,d41d8cd98f00b204,3rzjuxgykcf4s6hgajckkcha.8kihejqt-iigr68g.knc@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:5007:6120:6261:6653:7875:9969:10004:10400:11026:11473:11658:11914:12043:12048:12296:12297:12438:12555:12895:13069:13138:13231:13255:13311:13357:14096:14097:14181:14659:14721:21080:21444:21451:21627:21990:30054,0,RBL:209.85.214.201:@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:24,LUA_SUMMARY:none X-HE-Tag: love52_2c653666b0f4f X-Filterd-Recvd-Size: 4462 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Mon, 24 Feb 2020 20:31:44 +0000 (UTC) Received: by mail-pl1-f201.google.com with SMTP id d9so5784190plo.10 for ; Mon, 24 Feb 2020 12:31:44 -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=08QeejR/Y5s2cfy/NCdgcPvTEtoUMyVGBG5/KrYbV84=; b=e8qyfBn+SSz6O/tQGDeDIK3IE4rb5DgnZwS0622dOWI6bmvf054PYXfQvB/oonlNz5 nGP9b7kLBB1oXbaEhp6qkvl9atZ9bevhf1Jemz8pP2a5edIBS4rmeh/wOS9p4f6nsqCZ pGbEOe073RReAOOVI9OB+9cWkRm9VqHItqXsrJ9FCDc4AKmFt2otcqq737EYRuWLsp2c RKHis28jPkZJWsZhKGSI6FLP01O/ErUWMtrdBCR7uz8DQ7bEzw1996/MwKWDSWiH5s3g hr3V1Rrvi3gXavysDM2gQeEaXnLT2hIqboXzIRQhhxPRv7NJcgyZMZ4zQwLBb9LhPjrJ 03ow== 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=08QeejR/Y5s2cfy/NCdgcPvTEtoUMyVGBG5/KrYbV84=; b=T7WzsIoWj5TzWsc4zvQe4aMJE3aZl0IhWr2sTbo4d54hB0AFst95ShjvePaMPbLmEE m2etv+5gi78NGfvDX2NvufDvVN1ytQufgr0kU9Dw5GUeG7onJvY0NkqJKM/XEAfaTz0t veMYb/75Mk/dmxr2QrGKs5XGTIy2oDWiqJCrF75jiYX8z67tL9qkfyNjdCmNkkvKU+sN 59t2DqFxo6xvwbMOO0K5mCtUlaeqzlf8WJfgTQz6PtISuYSZQCyH4YQxTlQQ55115OnL N1XQXr8KpQJ796oLQVLZ0BCee3rAzWUdLdEpyx1OkOsPhr9f/7yOpO/7BhcWCfJY61Lj Qpag== X-Gm-Message-State: APjAAAXeIyFSDkv8y/D81afGuMs0cy/d/Z+rh57fnp0Ohu5zoh/xEMih N04mfnywIr8EhEJ0m1IlOsC98uAdlkM= X-Google-Smtp-Source: APXvYqxx8gT90lpqufF5H7UH4zW1kjTbeFyLTB6l1zTJrC+PZC5OwzFYKJEgMpBEMwYyqecI+DZH8Yg3wXU= X-Received: by 2002:a63:7c16:: with SMTP id x22mr54892615pgc.335.1582576303918; Mon, 24 Feb 2020 12:31:43 -0800 (PST) Date: Mon, 24 Feb 2020 12:30:51 -0800 In-Reply-To: <20200224203057.162467-1-walken@google.com> Message-Id: <20200224203057.162467-19-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 18/24] shared file mappings: 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: Modify lock_page_maybe_drop_mmap() and maybe_unlock_mmap_for_io() to use the vmf->range field when dropping mmap_sem. This covers dropping mmap_sem during: - filemap_fault() - shmem_fault() - do_fault() write to shared file mapping [ through do_shared_fault and fault_dirty_shared_page() ] - do_wp_page() write to shared file mapping [ through wp_page_shared() and fault_dirty_shared_page() ] Signed-off-by: Michel Lespinasse --- mm/filemap.c | 3 ++- mm/internal.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git mm/filemap.c mm/filemap.c index 3afb5a3f0b9c..7827de7b356c 100644 --- mm/filemap.c +++ mm/filemap.c @@ -2364,7 +2364,8 @@ static int lock_page_maybe_drop_mmap(struct vm_fault *vmf, struct page *page, * mmap_sem here and return 0 if we don't have a fpin. */ if (*fpin == NULL) - mm_read_unlock(vmf->vma->vm_mm); + mm_read_range_unlock(vmf->vma->vm_mm, + vmf->range); return 0; } } else diff --git mm/internal.h mm/internal.h index 22f361a1e284..9bfff428c5da 100644 --- mm/internal.h +++ mm/internal.h @@ -382,7 +382,7 @@ static inline struct file *maybe_unlock_mmap_for_io(struct vm_fault *vmf, if ((flags & (FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_RETRY_NOWAIT)) == FAULT_FLAG_ALLOW_RETRY) { fpin = get_file(vmf->vma->vm_file); - mm_read_unlock(vmf->vma->vm_mm); + mm_read_range_unlock(vmf->vma->vm_mm, vmf->range); } return fpin; }