From patchwork Wed Jan 4 00:27:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Kravetz X-Patchwork-Id: 13088128 X-Patchwork-Delegate: palmer@dabbelt.com 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A7AFCC3DA7D for ; Wed, 4 Jan 2023 00:31:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=l/YCW7rPskHX7hFXAH5vZqCmNchvaCGWfIqmPfM/HDo=; b=nQs5Mxa8IONK+F vBMeADTGdTpyAYJwsUY9VXRJhb73QW7qCizb5Xa8DGDYHIN+jjRA9pUCn2XeVvX0uCAGnQyFtWzMR SbTGE+RYpmFzXe5K4BE2+SVc51fe90BxBr44gdmwf1CxBj6ldJv2k6U0M9Tzs0yssFb9+DgtrfO0/ SOISsSLA0aLfv8QVWqhiV7YP6wKEbNASKRZ840fxzCgfzLSWCvKXgjakJxMvL/EQzQ2jZF/50wu43 E8nSDjepyb4bGYQTKQFh5mVtBhJPoiAexAxRavzlqouV1pj3+tWCebeaGrtm25KfIMAeT2uEGUImg spAmcYTukBMwvH1P9tvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCrgc-005sLo-54; Wed, 04 Jan 2023 00:31:18 +0000 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCrdw-005rL8-NA for linux-riscv@lists.infradead.org; Wed, 04 Jan 2023 00:28:35 +0000 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 303Jn3AU000313; Wed, 4 Jan 2023 00:28:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=aoCSdc3IxCqWcsTPrDFmX3OILlpp9T3BLxXn3Dy1W6I=; b=f75F/F/BLYcMa2zeZjf5ar78aNIMY5jSAGUNBnmTyZXoFdIJlWRBrT8nAaeHzq8dVj75 G0eJRX8FepyUJLuEa8w/VfSY3i39fSQO73R7Hp4RO2eHWJem21mURvgNe1XNMAtXf3cL ZgOneFpUrRIyrUksFczj9HXJkyc63hhUxbbVnTym+EhgsMPkqJna+yw16xpQMlHlOuGS hVZLsgEXGFCGZj3T30aMQrwMM08ebnudjC0mK/xxip4P1d4sipmF6n/upnK/Nwthwks9 qgnP201n6pANyWhgwc+zrnIxzHsR/N/8A4eIiXScvGtMvKRQAzjye0z5zoVNZsDFS6KC 4w== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3mtdmtnbh0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 Jan 2023 00:28:02 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 303MwcHk013691; Wed, 4 Jan 2023 00:28:01 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2176.outbound.protection.outlook.com [104.47.57.176]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3mvwmjj636-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 Jan 2023 00:28:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JNvYb4nfmFgd7XiH9I1IHOqfyycaJDQOR9dCR1fsY4jeLZzvFwUoxUqeVN9qnudiM3JaVkdZE/sx5isG7kc5Lty7lqJBDa6ikt2UxRi2Fq6+WG8C0HK+9Ol9y1dKjK12lVelRW6njOwehs/gOe9wbYn8mXCR+S64GFN+ZD0uIfVqLPVgxVOmdmLOpcUYOulhbjaDJe8SfSCvF3O1Jo7bDffMZPh8SePpyMvI78wKSVarRmpVQMihfl4zCURPO50jDcYxQw0Pettscu517WuKdtmh7PRlkzhrOx9vlf1BjkJFoQp9SNME1/7M/MyLGiMNY//CVjq8W5udvxS1FHcbxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aoCSdc3IxCqWcsTPrDFmX3OILlpp9T3BLxXn3Dy1W6I=; b=DDTse2ioJGYRo8cZk+EiHF2A5OeKqmK/UBnVUW96Aoinq6iyD6EneLRVZ/zZPK7mDop0mnBEt3TKYGZ/8e50Nzh6a7dri9PD97CvAVPnHXoFY6adf8HETUYKLJ354D6Cmnqo8aDXHgxHfnBMlwhqj5cQOkC3+H860BlR6w6J/aYdTXHeLHazby4Hn7ZbgY0HROwr7vEV7gKGrbnOdwyc6XltQ2CCorBoGn5OJG9Givbl7lKubRZbekO3XilxdV7OAt17Ch5YYKltjBRVGCuXCpOoPFFGteUeux0V8Yl7kTf2uBOSqDnMzxmOv6frWmilkv9ytSw7Ymc+C37PccthOw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aoCSdc3IxCqWcsTPrDFmX3OILlpp9T3BLxXn3Dy1W6I=; b=0Rc/i7I5b0d68TJE8UlGeXjAUQ/FKMI0huY9CnFmvgvueRSrEI4xWlkhl6+c2wTCdXvPXTQgLFuy1nzZ5qpn7Y2+Jqp1FOHsc3UUjRbjNvoBGm68FtvVTRWBWfE4OqcmYfRs2pzMBdT8gGj0NMFhihIVIyORc/0no5u2jT+btbU= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by CH3PR10MB7496.namprd10.prod.outlook.com (2603:10b6:610:164::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 00:27:36 +0000 Received: from BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::3a1:b634:7903:9d14]) by BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::3a1:b634:7903:9d14%8]) with mapi id 15.20.5944.019; Wed, 4 Jan 2023 00:27:36 +0000 From: Mike Kravetz To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, netdev@vger.kernel.org Cc: Christoph Hellwig , David Hildenbrand , Michal Hocko , Peter Xu , Nadav Amit , Matthew Wilcox , Vlastimil Babka , Rik van Riel , Will Deacon , Michael Ellerman , Palmer Dabbelt , Christian Borntraeger , Dave Hansen , Christian Brauner , Eric Dumazet , Andrew Morton , Mike Kravetz Subject: [PATCH] mm: remove zap_page_range and create zap_vma_pages Date: Tue, 3 Jan 2023 16:27:32 -0800 Message-Id: <20230104002732.232573-1-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.38.1 X-ClientProxiedBy: MW4PR03CA0075.namprd03.prod.outlook.com (2603:10b6:303:b6::20) To BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR10MB4196:EE_|CH3PR10MB7496:EE_ X-MS-Office365-Filtering-Correlation-Id: b5674cfd-b8d3-49a5-3e48-08daedea7aac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9MQSiTxk3MmzMfQqBaHv+Ri35jRk+Q+MgHEKDqZ6ad3d4/n0gf1rp1D2YAwqLhrUFYQABQJuJuccdRXByV4xIFlByegRHorAkEyjiZMfzRwlGfqZ100pG/gLWPS8aqJmqYtNU5ZkOrEP2ZiKt6pFZCUOZthpE7VqLLB4QTO1KE6AKfXvhpjPUork9u2CuTdyA5aXpscB8iWEZ+tYhIWLJpFsU6pXhcxf3C+Mx5u7nLShrcjWxMfzeTCWlhT73S2ntvj9MFFldK5+811w+yfpnN/Fyyjo85bX6oNfYpEOwk4P6WVDTuv/6yQxmgx3wBUyrOc6NG0lxOp6gF3KlCDOx1ssldRh5f88oh7wVa5dcg5NHLl0wicSspDfYODBeVnpSe++YLm/mSxzCdg3Y5JdAYdgXcaAb7QOzkcyaS3q35lhlkVMUKOV/rbO8lwpIvLwxoGy996eJvdMi5QnAAQDtdHCwVjPlA05JXm7S1FGAmMyZvZSHsii7D9S/vJJSMaG1SgZ5aQbiDRZbTnz4888SWrTpYwLnatej0hsSmBsxLHYypwEetFuUiwCHTmCicUAPARMe37SvSXS8xtZvxg0Yez7xjH30fS56R0O4xRgy6wGUgFMrfgnCAmhvBAcm4W8MYXECMPWiKqrC/sFTKtAC74bZiRCkMXekBWj4A4gCWQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4196.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(136003)(396003)(39860400002)(346002)(376002)(451199015)(26005)(30864003)(1076003)(186003)(2616005)(6512007)(38100700002)(86362001)(83380400001)(36756003)(44832011)(7416002)(41300700001)(8936002)(8676002)(4326008)(5660300002)(66556008)(66946007)(6666004)(316002)(107886003)(66476007)(966005)(6486002)(478600001)(54906003)(6506007)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WT862/fL+SxChoAPQSuNrqsUQXlAUhKJ7XmwhS2cB/ZLv71dbm1ZoRC5KwAZ502uNLNTimax9bdu1GzggDDk5GAQJFeNGHLn55wgJUo5MmVNtZYZ1seY3iJOLhn37nR2c7EOS02hA4okADgPgqEgpbDZ+gKtcqK3MCwxMI6tY792nnewIAzlpv16V/avYDF/jLUTDcdZ4snUdHm+sxlK1TRkaKVhnYlScL7PoSh7uBw6ELTXSwOe1xKNColQWC/ZcROkqOcniDyNlXfuWbsFoHLQbKqeK62CybuQyJCHnBM0mdHp2xQFvSN3GdyQFpIMj3uMpUJ/tmF5eyYJm2VxLE1nag2cOG4fS8najyOqr0YYyGsCmvUdL870v6EKQ7vRuuWzQ1NW15PVSMOzkHyFOF4n7zHL9/PdmGvki+750z0yseuTMvaiaO4xSWxFZL/lPRSKqp5Xpve7Ffc2W1tlvI9CE77X1sGIVUigU3F0IZUAJgFUi0EFqgyhbxBhyG3c2YhYGJGlLcCg1WdSW/oL1FRZ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09g8DZ67/gqUUqBMS5qF+padl4JaG14eBCmOhW+ev1grDLGD1sl1Ph6VvyhecmE4VlwW4ypUH7uTwd3lE4Eu0kU30QaRmVcgGuviGyyQPWMHfrljrHQTsZe6gykNbJ6y9SvkKz9+xsEG3Yt/vEDDNqIPUwJ2YqZOX2Lzy7SIDslT0b+xbyDi3xgKmmmtHinKmbh8qe3OR6xTpH8dYYl3wtmftCrgo+UF79R1vVBSs5kk+wqCktPNR+dVyrjRPiV3mACL5Lv0VNdNeyjLX4x17bO6xvNGbqU5nEYltVcPx/N+31FpckQbyv3tJJVbG8LUo1x9vxshmseFhRsoOo4P1g533YlGEtvVgUAtLylYPyEm71IZA9tyINwSHM4LLj3XzKsw8N1LkaTsJhcVOnCd1aTklBYhUVQaD+/5laGYw8bNPC48p6vFiGfmsta5gs4lEds1NF7E4nwaYdxH75QpSVbALSvS21uZXCIlrp2TBJrKEpugSvuTkcJ8Z6Xrw6Wpzosogc4kg/1 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5674cfd-b8d3-49a5-3e48-08daedea7aac X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 00:27:36.4459 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ueCL4adKmenjXSPAqM5mmmwGM1Y99tlKfxUQyE/itfI9MxKww7cepSASoAtFZvJO+L27imRIFSBDc7aBl1/SUg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7496 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-03_08,2023-01-03_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 phishscore=0 adultscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301040002 X-Proofpoint-GUID: 7oCefhu8HPTyVclxe1iF2ymLOiMCUf9M X-Proofpoint-ORIG-GUID: 7oCefhu8HPTyVclxe1iF2ymLOiMCUf9M X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230103_162832_828530_D72DC4C7 X-CRM114-Status: GOOD ( 19.03 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org zap_page_range was originally designed to unmap pages within an address range that could span multiple vmas. While working on [1], it was discovered that all callers of zap_page_range pass a range entirely within a single vma. In addition, the mmu notification call within zap_page range does not correctly handle ranges that span multiple vmas. When crossing a vma boundary, a new mmu_notifier_range_init/end call pair with the new vma should be made. Instead of fixing zap_page_range, do the following: - Create a new routine zap_vma_pages() that will remove all pages within the passed vma. Most users of zap_page_range pass the entire vma and can use this new routine. - For callers of zap_page_range not passing the entire vma, instead call zap_page_range_single(). - Remove zap_page_range. [1] https://lore.kernel.org/linux-mm/20221114235507.294320-2-mike.kravetz@oracle.com/ Suggested-by: Peter Xu Signed-off-by: Mike Kravetz Acked-by: Michal Hocko Acked-by: Peter Xu Acked-by: Heiko Carstens Reviewed-by: Christoph Hellwig Acked-by: Palmer Dabbelt # RISC-V --- RFC->v1 Created zap_vma_pages to zap entire vma (Christoph Hellwig) Did not add Acked-by's as routine was changed. arch/arm64/kernel/vdso.c | 6 ++--- arch/powerpc/kernel/vdso.c | 4 +--- arch/powerpc/platforms/book3s/vas-api.c | 2 +- arch/powerpc/platforms/pseries/vas.c | 3 +-- arch/riscv/kernel/vdso.c | 6 ++--- arch/s390/kernel/vdso.c | 4 +--- arch/s390/mm/gmap.c | 2 +- arch/x86/entry/vdso/vma.c | 4 +--- drivers/android/binder_alloc.c | 2 +- include/linux/mm.h | 7 ++++-- mm/memory.c | 30 ------------------------- mm/page-writeback.c | 2 +- net/ipv4/tcp.c | 7 +++--- 13 files changed, 21 insertions(+), 58 deletions(-) diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index e59a32aa0c49..0119dc91abb5 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -138,13 +138,11 @@ int vdso_join_timens(struct task_struct *task, struct time_namespace *ns) mmap_read_lock(mm); for_each_vma(vmi, vma) { - unsigned long size = vma->vm_end - vma->vm_start; - if (vma_is_special_mapping(vma, vdso_info[VDSO_ABI_AA64].dm)) - zap_page_range(vma, vma->vm_start, size); + zap_vma_pages(vma); #ifdef CONFIG_COMPAT_VDSO if (vma_is_special_mapping(vma, vdso_info[VDSO_ABI_AA32].dm)) - zap_page_range(vma, vma->vm_start, size); + zap_vma_pages(vma); #endif } diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c index 507f8228f983..7a2ff9010f17 100644 --- a/arch/powerpc/kernel/vdso.c +++ b/arch/powerpc/kernel/vdso.c @@ -120,10 +120,8 @@ int vdso_join_timens(struct task_struct *task, struct time_namespace *ns) mmap_read_lock(mm); for_each_vma(vmi, vma) { - unsigned long size = vma->vm_end - vma->vm_start; - if (vma_is_special_mapping(vma, &vvar_spec)) - zap_page_range(vma, vma->vm_start, size); + zap_vma_pages(vma); } mmap_read_unlock(mm); diff --git a/arch/powerpc/platforms/book3s/vas-api.c b/arch/powerpc/platforms/book3s/vas-api.c index eb5bed333750..9580e8e12165 100644 --- a/arch/powerpc/platforms/book3s/vas-api.c +++ b/arch/powerpc/platforms/book3s/vas-api.c @@ -414,7 +414,7 @@ static vm_fault_t vas_mmap_fault(struct vm_fault *vmf) /* * When the LPAR lost credits due to core removal or during * migration, invalidate the existing mapping for the current - * paste addresses and set windows in-active (zap_page_range in + * paste addresses and set windows in-active (zap_vma_pages in * reconfig_close_windows()). * New mapping will be done later after migration or new credits * available. So continue to receive faults if the user space diff --git a/arch/powerpc/platforms/pseries/vas.c b/arch/powerpc/platforms/pseries/vas.c index 4ad6e510d405..559112312810 100644 --- a/arch/powerpc/platforms/pseries/vas.c +++ b/arch/powerpc/platforms/pseries/vas.c @@ -760,8 +760,7 @@ static int reconfig_close_windows(struct vas_caps *vcap, int excess_creds, * is done before the original mmap() and after the ioctl. */ if (vma) - zap_page_range(vma, vma->vm_start, - vma->vm_end - vma->vm_start); + zap_vma_pages(vma); mmap_write_unlock(task_ref->mm); mutex_unlock(&task_ref->mmap_mutex); diff --git a/arch/riscv/kernel/vdso.c b/arch/riscv/kernel/vdso.c index e410275918ac..5c30212d8d1c 100644 --- a/arch/riscv/kernel/vdso.c +++ b/arch/riscv/kernel/vdso.c @@ -124,13 +124,11 @@ int vdso_join_timens(struct task_struct *task, struct time_namespace *ns) mmap_read_lock(mm); for_each_vma(vmi, vma) { - unsigned long size = vma->vm_end - vma->vm_start; - if (vma_is_special_mapping(vma, vdso_info.dm)) - zap_page_range(vma, vma->vm_start, size); + zap_vma_pages(vma); #ifdef CONFIG_COMPAT if (vma_is_special_mapping(vma, compat_vdso_info.dm)) - zap_page_range(vma, vma->vm_start, size); + zap_vma_pages(vma); #endif } diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c index ff7bf4432229..bbaefd84f15e 100644 --- a/arch/s390/kernel/vdso.c +++ b/arch/s390/kernel/vdso.c @@ -59,11 +59,9 @@ int vdso_join_timens(struct task_struct *task, struct time_namespace *ns) mmap_read_lock(mm); for_each_vma(vmi, vma) { - unsigned long size = vma->vm_end - vma->vm_start; - if (!vma_is_special_mapping(vma, &vvar_mapping)) continue; - zap_page_range(vma, vma->vm_start, size); + zap_vma_pages(vma); break; } mmap_read_unlock(mm); diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c index 74e1d873dce0..69af6cdf1a2a 100644 --- a/arch/s390/mm/gmap.c +++ b/arch/s390/mm/gmap.c @@ -722,7 +722,7 @@ void gmap_discard(struct gmap *gmap, unsigned long from, unsigned long to) if (is_vm_hugetlb_page(vma)) continue; size = min(to - gaddr, PMD_SIZE - (gaddr & ~PMD_MASK)); - zap_page_range(vma, vmaddr, size); + zap_page_range_single(vma, vmaddr, size, NULL); } mmap_read_unlock(gmap->mm); } diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c index b8f3f9b9e53c..ec5e4d2048cb 100644 --- a/arch/x86/entry/vdso/vma.c +++ b/arch/x86/entry/vdso/vma.c @@ -113,10 +113,8 @@ int vdso_join_timens(struct task_struct *task, struct time_namespace *ns) mmap_read_lock(mm); for_each_vma(vmi, vma) { - unsigned long size = vma->vm_end - vma->vm_start; - if (vma_is_special_mapping(vma, &vvar_mapping)) - zap_page_range(vma, vma->vm_start, size); + zap_vma_pages(vma); } mmap_read_unlock(mm); diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c index 4ad42b0f75cd..55a3c3c2409f 100644 --- a/drivers/android/binder_alloc.c +++ b/drivers/android/binder_alloc.c @@ -1019,7 +1019,7 @@ enum lru_status binder_alloc_free_page(struct list_head *item, if (vma) { trace_binder_unmap_user_start(alloc, index); - zap_page_range(vma, page_addr, PAGE_SIZE); + zap_page_range_single(vma, page_addr, PAGE_SIZE, NULL); trace_binder_unmap_user_end(alloc, index); } diff --git a/include/linux/mm.h b/include/linux/mm.h index c1ea18bc99e2..e4374baadbf3 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1977,10 +1977,13 @@ struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr, void zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, unsigned long size); -void zap_page_range(struct vm_area_struct *vma, unsigned long address, - unsigned long size); void zap_page_range_single(struct vm_area_struct *vma, unsigned long address, unsigned long size, struct zap_details *details); +static inline void zap_vma_pages(struct vm_area_struct *vma) +{ + zap_page_range_single(vma, vma->vm_start, + vma->vm_end - vma->vm_start, NULL); +} void unmap_vmas(struct mmu_gather *tlb, struct maple_tree *mt, struct vm_area_struct *start_vma, unsigned long start, unsigned long end); diff --git a/mm/memory.c b/mm/memory.c index 4000e9f017e0..14e63e14adc4 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1693,36 +1693,6 @@ void unmap_vmas(struct mmu_gather *tlb, struct maple_tree *mt, mmu_notifier_invalidate_range_end(&range); } -/** - * zap_page_range - remove user pages in a given range - * @vma: vm_area_struct holding the applicable pages - * @start: starting address of pages to zap - * @size: number of bytes to zap - * - * Caller must protect the VMA list - */ -void zap_page_range(struct vm_area_struct *vma, unsigned long start, - unsigned long size) -{ - struct maple_tree *mt = &vma->vm_mm->mm_mt; - unsigned long end = start + size; - struct mmu_notifier_range range; - struct mmu_gather tlb; - MA_STATE(mas, mt, vma->vm_end, vma->vm_end); - - lru_add_drain(); - mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, vma->vm_mm, - start, start + size); - tlb_gather_mmu(&tlb, vma->vm_mm); - update_hiwater_rss(vma->vm_mm); - mmu_notifier_invalidate_range_start(&range); - do { - unmap_single_vma(&tlb, vma, start, range.end, NULL); - } while ((vma = mas_find(&mas, end - 1)) != NULL); - mmu_notifier_invalidate_range_end(&range); - tlb_finish_mmu(&tlb); -} - /** * zap_page_range_single - remove user pages in a given range * @vma: vm_area_struct holding the applicable pages diff --git a/mm/page-writeback.c b/mm/page-writeback.c index ad608ef2a243..ffa36cfe5884 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2713,7 +2713,7 @@ void folio_account_cleaned(struct folio *folio, struct bdi_writeback *wb) * * The caller must hold lock_page_memcg(). Most callers have the folio * locked. A few have the folio blocked from truncation through other - * means (eg zap_page_range() has it mapped and is holding the page table + * means (eg zap_vma_pages() has it mapped and is holding the page table * lock). This can also be called from mark_buffer_dirty(), which I * cannot prove is always protected against truncate. */ diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index c567d5e8053e..f713c0422f0f 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2092,7 +2092,7 @@ static int tcp_zerocopy_vm_insert_batch_error(struct vm_area_struct *vma, maybe_zap_len = total_bytes_to_map - /* All bytes to map */ *length + /* Mapped or pending */ (pages_remaining * PAGE_SIZE); /* Failed map. */ - zap_page_range(vma, *address, maybe_zap_len); + zap_page_range_single(vma, *address, maybe_zap_len, NULL); err = 0; } @@ -2100,7 +2100,7 @@ static int tcp_zerocopy_vm_insert_batch_error(struct vm_area_struct *vma, unsigned long leftover_pages = pages_remaining; int bytes_mapped; - /* We called zap_page_range, try to reinsert. */ + /* We called zap_page_range_single, try to reinsert. */ err = vm_insert_pages(vma, *address, pending_pages, &pages_remaining); @@ -2234,7 +2234,8 @@ static int tcp_zerocopy_receive(struct sock *sk, total_bytes_to_map = avail_len & ~(PAGE_SIZE - 1); if (total_bytes_to_map) { if (!(zc->flags & TCP_RECEIVE_ZEROCOPY_FLAG_TLB_CLEAN_HINT)) - zap_page_range(vma, address, total_bytes_to_map); + zap_page_range_single(vma, address, total_bytes_to_map, + NULL); zc->length = total_bytes_to_map; zc->recv_skip_hint = 0; } else {