From patchwork Fri Aug 16 11:13:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bert Karwatzki X-Patchwork-Id: 13766009 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 C1DFCC531DC for ; Fri, 16 Aug 2024 11:15:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BCDAC6B0177; Fri, 16 Aug 2024 07:14:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B52C78D0070; Fri, 16 Aug 2024 07:14:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 933B16B0177; Fri, 16 Aug 2024 07:14:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5F4656B0177 for ; Fri, 16 Aug 2024 07:14:43 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 1DAB9C04FC for ; Fri, 16 Aug 2024 11:14:43 +0000 (UTC) X-FDA: 82457850846.05.E819C97 Received: from mout.web.de (mout.web.de [217.72.192.78]) by imf13.hostedemail.com (Postfix) with ESMTP id 30B6D20014 for ; Fri, 16 Aug 2024 11:14:40 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=web.de header.s=s29768273 header.b=PnWlvgWq; spf=pass (imf13.hostedemail.com: domain of spasswolf@web.de designates 217.72.192.78 as permitted sender) smtp.mailfrom=spasswolf@web.de; dmarc=pass (policy=quarantine) header.from=web.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723806808; 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:in-reply-to:references:references:dkim-signature; bh=/7yEM/06EBzG8T4jP9FKzjOed5lkzr+9lbfhTuSKD54=; b=UlXBYRZ+8vxuc/mtz7fnimcyHpi4XM+hnu3+ar++DewASkZq3Sg+9u5tJT6R4dMR4DqXkK eJNBZUiK3kEHphzY0KMQGpg71Ope2qQ/d3zdSVtEgG/9ESs4CKJl5NPnUlapiFa8SOEo6I fW/maiJEcc2gv7m1BvEtLWR+J+szPvo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723806808; a=rsa-sha256; cv=none; b=gH8IfpdKyzOxHvoxaluwWlkEHaWvyPmOfvmXdq7L1aO9yNkLw36XUEndAE841X2y4Ikb/M vK4sqyVdtv31CSKhAZJGfYjtIQU0dZCSPK2VqMji6URBwCFiLQm2dXmMvnhWWvadNgCsih f1Un1zgAsxGilnKF8JBxrUuoalqZfls= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=web.de header.s=s29768273 header.b=PnWlvgWq; spf=pass (imf13.hostedemail.com: domain of spasswolf@web.de designates 217.72.192.78 as permitted sender) smtp.mailfrom=spasswolf@web.de; dmarc=pass (policy=quarantine) header.from=web.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1723806874; x=1724411674; i=spasswolf@web.de; bh=/7yEM/06EBzG8T4jP9FKzjOed5lkzr+9lbfhTuSKD54=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=PnWlvgWq07rw5K2AbEW/W0YHB8+83pEqmsERFc8LTpYPSnQO8i5dBCClBupZILvI nKHQwo/AFeV2PU+bLnYTDKjxej3jlSfcDzypXbta/Gik8nBeUCaVNKEjXCBynFJOL OPI4SrrhQrhv6Frf9je2f+Bn+s/Y3aCogMQHw/+p8AfzHwHiCbSvrsb5G7aN7Y7si ein9Sy73F60/nCHqyHj27HrLYc8Cmh52Jyx0yzl4uVmnm/uYFfDD63/JlPQ/bn5Hz yJGo7Fn0OU8aUJUe1mIVTSvgRgMFFEMha4RJo0Q0IVnzArcj/PrHS+8EzwRQRNGiY Rq2szIHGOqxaInQABg== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from localhost.localdomain ([84.119.92.193]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1N0qr9-1sHjG03Qph-012U23; Fri, 16 Aug 2024 13:14:33 +0200 From: Bert Karwatzki To: "Liam R . Howlett" Cc: Bert Karwatzki , Suren Baghdasaryan , Vlastimil Babka , Lorenzo Stoakes , Matthew Wilcox , sidhartha.kumar@oracle.com, "Paul E . McKenney" , Jiri Olsa , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Kees Cook , Jeff Xu , "Liam R . Howlett" , Lorenzo Stoakes Subject: [PATCH v5.1 13/19] mm/mmap: Clean up unmap_region() argument list Date: Fri, 16 Aug 2024 13:13:54 +0200 Message-ID: <20240816111405.11793-14-spasswolf@web.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240816111405.11793-1-spasswolf@web.de> References: <20240816111405.11793-1-spasswolf@web.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:jcyktmfYp2H8ZpYasihi+6y9QqrVM70RvOr4ii4E0k7G04jdQfr WRh/wc07K8NzAyi0df2eqblsJNtMNODFUvfx0e6ON3i+aUPh3lth9islkc/OC61HvgNrx1j rwhjBWEYxangRdzx7VNJCcfzL8YnfnreVppys89DZeALsqEsuEbG6hFOK20dXCS4kT+YZbz 8aOg+qnqVRU2DwJjE4l3w== UI-OutboundReport: notjunk:1;M01:P0:VHYw7/oy+O4=;fk6pGRSVvznfcKvi0qmAW8Ep6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DIns/eaGbPLfhv27MUNrQCHElndx0ODZdBh31zF5P5N9obV4Ml2aKPVc6W94FvinjzMpktBjafC+5ccuWiQxMhzNkF4oqQQdbgNHWOqI8TpSV68tuWkCctNlcEBmeUEZ4A 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: List-Subscribe: List-Unsubscribe: With the only caller to unmap_region() being the error path of mmap_region(), the argument list can be significantly reduced. There is also no need to forward declare the static function any longer. Signed-off-by: Liam R. Howlett Reviewed-by: Lorenzo Stoakes --- mm/mmap.c | 3 +-- mm/vma.c | 17 ++++++++--------- mm/vma.h | 6 ++---- 3 files changed, 11 insertions(+), 15 deletions(-) -- 2.45.2 diff --git a/mm/mmap.c b/mm/mmap.c index 6720b55b47ed..1f0b8dc5a089 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1617,8 +1617,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr, vma_iter_set(&vmi, vma->vm_end); /* Undo any partial mapping done by a device driver. */ - unmap_region(mm, &vmi.mas, vma, prev, next, vma->vm_start, - vma->vm_end, vma->vm_end, true); + unmap_region(&vmi.mas, vma, prev, next); } if (writable_file_mapping) mapping_unmap_writable(file->f_mapping); diff --git a/mm/vma.c b/mm/vma.c index e106d412c4c3..0244320d76ab 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -155,22 +155,21 @@ void remove_vma(struct vm_area_struct *vma, bool unreachable) * * Called with the mm semaphore held. */ -void unmap_region(struct mm_struct *mm, struct ma_state *mas, - struct vm_area_struct *vma, struct vm_area_struct *prev, - struct vm_area_struct *next, unsigned long start, - unsigned long end, unsigned long tree_end, bool mm_wr_locked) +void unmap_region(struct ma_state *mas, struct vm_area_struct *vma, + struct vm_area_struct *prev, struct vm_area_struct *next) { + struct mm_struct *mm = vma->vm_mm; struct mmu_gather tlb; - unsigned long mt_start = mas->index; lru_add_drain(); tlb_gather_mmu(&tlb, mm); update_hiwater_rss(mm); - unmap_vmas(&tlb, mas, vma, start, end, tree_end, mm_wr_locked); - mas_set(mas, mt_start); + unmap_vmas(&tlb, mas, vma, vma->vm_start, vma->vm_end, vma->vm_end, + /* mm_wr_locked = */ true); + mas_set(mas, vma->vm_end); free_pgtables(&tlb, mas, vma, prev ? prev->vm_end : FIRST_USER_ADDRESS, - next ? next->vm_start : USER_PGTABLES_CEILING, - mm_wr_locked); + next ? next->vm_start : USER_PGTABLES_CEILING, + /* mm_wr_locked = */ true); tlb_finish_mmu(&tlb); } diff --git a/mm/vma.h b/mm/vma.h index b857e7dc4bfe..2a2ca489e622 100644 --- a/mm/vma.h +++ b/mm/vma.h @@ -108,10 +108,8 @@ int do_vmi_munmap(struct vma_iterator *vmi, struct mm_struct *mm, void remove_vma(struct vm_area_struct *vma, bool unreachable); -void unmap_region(struct mm_struct *mm, struct ma_state *mas, - struct vm_area_struct *vma, struct vm_area_struct *prev, - struct vm_area_struct *next, unsigned long start, - unsigned long end, unsigned long tree_end, bool mm_wr_locked); +void unmap_region(struct ma_state *mas, struct vm_area_struct *vma, + struct vm_area_struct *prev, struct vm_area_struct *next); /* Required by mmap_region(). */ bool