From patchwork Tue Jul 11 20:20:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13309341 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F827EB64DC for ; Tue, 11 Jul 2023 20:21:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE8488D0003; Tue, 11 Jul 2023 16:21:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A97B38D0002; Tue, 11 Jul 2023 16:21:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 960E78D0003; Tue, 11 Jul 2023 16:21:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 884678D0002 for ; Tue, 11 Jul 2023 16:21:10 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 58D8980378 for ; Tue, 11 Jul 2023 20:21:10 +0000 (UTC) X-FDA: 81000450300.04.7EDC61B Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf26.hostedemail.com (Postfix) with ESMTP id AB6EF14000E for ; Tue, 11 Jul 2023 20:21:08 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=drSNAqWz; dmarc=none; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689106868; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=00hsB+Y4M5JO8/62NZk9UtoHdoy3ZfWp29zMafKN3zE=; b=jEmVj86MNgOsYiqzoi2xfA2Xpiub8LHbfg7Ht8bYAuNEjO//PRJc1jhPOeqUi0Gj27WxcD B6NseeCw3tJF/QV4kQwrchpeNIrP46EME/Ro9bYV+zNwpeSxAKvxMOmA1Eqk4r7SlSkDGA zaBEw0p6wnBvCFgtzdvGCy6c2a4LTa0= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=drSNAqWz; dmarc=none; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689106868; a=rsa-sha256; cv=none; b=iWMdlDJHZrjMGlVv6P1D/LiMzEYYpp5elLGuUL0JKsVlLhbJyCOHkyq8bM6/LnzJIsEz7+ c7bAWoOWJMz2Wor6w1HerwJFhbFrXcklZrNU7G+MH2TgNDR1KXgzFT3WzdG8WXwvZrmVC+ m9mgsVYmGBM49fuiDXeKYTvQ/e2E/uM= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=00hsB+Y4M5JO8/62NZk9UtoHdoy3ZfWp29zMafKN3zE=; b=drSNAqWzPHXvG1fHPHNBuVN+GS Ffnjr1LSBAvoZBCBhghrldztaIaeJrnCs9UysIXC8jIhddNTC6mTs+VQXLfK6sFXZzudBEBkyF4ca oBrrvS4zv8HwHtrl26FubsHZQ3pVopbE45Z3gAllE+E1diC+PyLWZjaKzXh++EAI3pj/quaYNLSwk u4/LaaLxAJneA8l54d+LOOi+X0V5r50KImF5Xc9y0J9Rj3PQF7NSOhA7nPn3opFkpdW/UfiEaHhUy SuFRNs9r7X6fOaqPpreBmXH9I0NK7ogiHqTARuirIAOKmF0CR6zVBR8LgVagTWwmeJAoqDDpU5kqX O8SQDxEQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qJJqr-00G1Q4-AM; Tue, 11 Jul 2023 20:20:49 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , Arjun Roy , Eric Dumazet , Suren Baghdasaryan , linux-fsdevel@vger.kernel.org, Punit Agrawal Subject: [PATCH v2 0/9] Avoid the mmap lock for fault-around Date: Tue, 11 Jul 2023 21:20:38 +0100 Message-Id: <20230711202047.3818697-1-willy@infradead.org> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 X-Rspamd-Queue-Id: AB6EF14000E X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 9w9emzshts3r7nbpnr7p9tq4r1fbaeht X-HE-Tag: 1689106868-20891 X-HE-Meta: U2FsdGVkX1/R/WVTPdvaxcBFlN+hG3Ugebdk4N3oBBXt275bQXxHv+ijnT3jcVRbngmn0hvx0It44O7mqrZD+Bbaj8PGHZ8Ukll3Mnhid3limg77qiB6BDiIdr/o+ZFub2vhlOzLtNJTcU8S6bY293qURPjoL3AVS9FXq5jgPANQHQiLWk5zBVrutFVUPFGxbOwNB+USIG0ffA0zNIDopXQb4NHDhNlI30+3sT3m/PwYFenMHzrgnKZEnfIQcdcx8RmA8t3bNwnivr4HuZSIdelWyFLulFSjxMfQQG8UgHQfdw/gIBKBGm+tLyuCdcA2JrbvRdV8KAZPCXtglE7c3zm3MP6a14WtP40SrZ8xuYb9C0/QfsMDJMP0KNEwuin/M/PljKAkPq4jUvkKG3wzknBU9lasnrhgNPg/jJrvo4bIQYiebOn5vXg75/e8btZDOkZZc4YVU3iR1BL7d4T6CMg+QoZCw4mZf6UFSik5jwseGO6OXu7TxvluhQ7WWy81zzLWETEqLu5OxbsNL6VkvgJKFTMbuPxA82FRSibyiwbaLZ7PTx3mhnfWZi0gVHWiCuGx1VYpET9aHOdjqAtTqUDb/y0+zLZWosaK03C/+2ecg06+8RMDeB+IROVPKbtTyDWUvw0Hyn+00SHqCgoUMdsieV+Y3hSNo1jRXuvUvVPYnS5Hm7qu8tm4n96GFPEiiB8OLy8RNOEvdvgnDflLPmJu9b07UsNAjebl1LlIAuDx1WwpZaOV68LRu6VxBzShpS+Ug3eFm01VRI1ursB5/91lzynY5v9Ry6PQVISECy+Ut7g3n/dmT2arAa+KuT/QnS1WiJUtOgXCbFKmrypBYIYB3rbXQ9CCydciBmo9conB58p0piwoMCig8knlJUAKfDS+U4Ei7/bqRVuWI4vqkBkUvvlO492EybqoYWYr3FjkofNiwcLQw/CVKP+NnoJMG6qhbmaFVF5srCeV59b 62vaUMEX yFLN5SEeR2oSCkAl+u3GvS1ycqQPqZwPqUyh8U5xXUZMW97cZzj4v1Jo+5lpTHYNCGPf5GcPO3gfmmtt3ywDpaxOKLGF9VXwmJa5EIgLV0koPNKS44B9QdQQEoQ== 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: This patchset adds the ability to handle page faults on parts of files which are already in the page cache without taking the mmap lock. I've taken a very gradual approach to pushing the lock down. I'm not 100% confident in my ability to grasp all the finer aspects of VMA handling, so some reviewrs may well feel that I could have combined some of these patches. I did try to skip one of these steps and it had a bug, so I feel justified in proceeding cautiously. Several people have volunteered to run benchmarks on this, so I haven't. I have run it through xfstests and it doesn't appear to introduce any regressions. This patchset is against next-20230711. There is a patch from Arjun Roy in there which has terrible conflicts with this work. At Eric Dumazet's suggestion I have started out by reverting it, then doing my patches and redoing Arjun's patch on top. It has the benefit of halving the size of Arjun's patch, Merging this is going to be a nightmare unless the networking tree reverts Arjun's patch (the mm tree can't revert a patch which isn't in the mm tree!). Arjun's patch did point out that using lock_vma_under_rcu() is currently very awkward, so that inspired patch 8 which makes it always available. Arjun Roy (1): tcp: Use per-vma locking for receive zerocopy Matthew Wilcox (Oracle) (8): Revert "tcp: Use per-vma locking for receive zerocopy" mm: Allow per-VMA locks on file-backed VMAs mm: Move FAULT_FLAG_VMA_LOCK check from handle_mm_fault() mm: Move FAULT_FLAG_VMA_LOCK check into handle_pte_fault() mm: Move FAULT_FLAG_VMA_LOCK check down in handle_pte_fault() mm: Move the FAULT_FLAG_VMA_LOCK check down from do_fault() mm: Run the fault-around code under the VMA lock mm: Remove CONFIG_PER_VMA_LOCK ifdefs MAINTAINERS | 1 - arch/arm64/mm/fault.c | 2 -- arch/powerpc/mm/fault.c | 4 ---- arch/riscv/mm/fault.c | 4 ---- arch/s390/mm/fault.c | 2 -- arch/x86/mm/fault.c | 4 ---- include/linux/mm.h | 6 ++++++ include/linux/net_mm.h | 17 ----------------- include/net/tcp.h | 1 - mm/hugetlb.c | 6 ++++++ mm/memory.c | 35 +++++++++++++++++++++++++---------- net/ipv4/tcp.c | 14 +++++--------- 12 files changed, 42 insertions(+), 54 deletions(-) delete mode 100644 include/linux/net_mm.h