From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0143339F190; Fri, 10 Jul 2026 20:27:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783715232; cv=none; b=JCQQ0moX0OVFs9XIRF8eZBg2/1LZcyByNTuI1C7eAxKbebylc7S4YjDFiiaMq5spaESvB3QauMUywLE/BUs7maqX3b63q27zf37IwTebBdF2/mit1BZTKlDb2oioYvhmAXu9691bDD5qB42xHhCl7qjgU0igqNzfQwqH1HtIkHo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783715232; c=relaxed/simple; bh=DYBIxKjyIjg2H1S6yqXRCrIrObFnJroA9O36yuI28hY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RGNqb4d/6WrxT1SVF/cb4s+V+y7cAXVjMzv5RyXMDPbMfauG1bOD/Zpk9LFZ5LvRJXhspytKptwCc2uBs8qLTrLLA3dlsmeFfzHxuck5gnDpTSNghMQkgP9rN4Idcez3EA1/suDUpT8Xp69DOqPs85bT3i7stmCs2VWmPixP/cg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=drJA3TiK; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="drJA3TiK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34F841F00A3A; Fri, 10 Jul 2026 20:26:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783715230; bh=IPE+/P9KdKkfiafscak8Qeedwgljtr0X+OnR3tsbkh0=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=drJA3TiK+PeoZ2nu79QhphTfcNqJcaVpJ8OrZAJ/WiBLBgSuNTzJICprZt5FC4O9S 3h2HjqlXf6uHYTGH6HKtyVkmlM9tNpsnzlHgJ8SgIXhPRwO8Mxflc7CI7u/LnJl1jN o3Y/oZKScReVzOIjwXvsQpQsUhs+NzRIePHqBDAniSxzca3Wp2d9hKCB6EFAc6Ena5 9eifILN5EaHhUs5Jl8ljfGagLXkvH/vjQc/WrufaW+JVZZLpI6hJqNBN9v+ubRWI+D f8OFGl0Cv9BKeEGVwh9lipVXptpUW5ZjL2aUnSqMgN5SfwTyhiP7bXRjj2XwzYCTtx 851hK/6GxFGqw== From: Lorenzo Stoakes Date: Fri, 10 Jul 2026 21:17:06 +0100 Subject: [PATCH v2 25/33] mm/vma: make vma_set_range() static, drop insert_vm_struct() decl Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260710-b4-pre-scalable-cow-v2-25-2a5aa403d977@kernel.org> References: <20260710-b4-pre-scalable-cow-v2-0-2a5aa403d977@kernel.org> In-Reply-To: <20260710-b4-pre-scalable-cow-v2-0-2a5aa403d977@kernel.org> To: Andrew Morton , David Hildenbrand , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Rik van Riel , Harry Yoo , Jann Horn , Lance Yang , Pedro Falcato , Russell King , Dinh Nguyen , Simon Schuster , "James E.J. Bottomley" , Helge Deller , Alexander Viro , Christian Brauner , Jan Kara , Dan Williams , Matthew Wilcox , Muchun Song , Oscar Salvador , Masami Hiramatsu , Oleg Nesterov , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Zi Yan , Baolin Wang , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Miaohe Lin , Naoya Horiguchi , Xu Xin , Chengming Zhou , SJ Park , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Hugh Dickins , Peter Xu , Kees Cook , Marek Szyprowski , Robin Murphy , Andrey Konovalov , Alexander Potapenko , Dmitry Vyukov , Steven Rostedt , Mathieu Desnoyers , Jarkko Sakkinen , Dave Hansen , Thomas Gleixner , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Ian Abbott , H Hartley Sweeten , Lucas Stach , Christian Gmeiner , David Airlie , Simona Vetter , Patrik Jakobsson , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , Tomi Valkeinen , Thierry Reding , Mikko Perttunen , Jonathan Hunter , Christian Koenig , Huang Rui , Matthew Auld , Jason Gunthorpe , Yishai Hadas , Shameer Kolothum , Kevin Tian , Ankit Agrawal , Alex Williamson , Paolo Bonzini , Shakeel Butt , Usama Arif Cc: Lorenzo Stoakes , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-parisc@vger.kernel.org, linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev, linux-perf-users@vger.kernel.org, linux-trace-kernel@vger.kernel.org, damon@lists.linux.dev, iommu@lists.linux.dev, kasan-dev@googlegroups.com, linux-sgx@vger.kernel.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-tegra@vger.kernel.org, kvm@vger.kernel.org, Russell King X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3631; i=ljs@kernel.org; h=from:subject:message-id; bh=DYBIxKjyIjg2H1S6yqXRCrIrObFnJroA9O36yuI28hY=; b=owGbwMvMwCV2fu7ZrsZH9SKMp9WSGLICg22X7tsrcNZQdubGGY8ZeW1e29V7zlxxOK3+cPbOG WeF5aVsOkpZGMS4GGTFFFmefxHfHyQSNq/zgr8bzBxWJpAhDFycAjCR14YM/9R8K5NV5Y2MWF6c vSte8e2PzcyIgNeTetd93BU5Q92s+h0jw6WMAI+VUk1/mc91c4Z2cZ/wmvv59r+qxuBd6nsvamy S5gAA X-Developer-Key: i=ljs@kernel.org; a=openpgp; fpr=E7F417BF5214569E89D04F46CF9DCD8A81E27F14 With __install_special_mapping() moved to vma.c, vma_set_range() can be made into a static function there and is now completely isolated from the rest of mm. While we're here, we can also remove the insert_vm_struct() declaration from mm.h - the function is implemented in vma.c and already declared in vma.h, and has no users outside of mm. Also update the VMA userland tests to reflect this change. No functional change intended. Reviewed-by: Pedro Falcato Reviewed-by: Gregory Price Signed-off-by: Lorenzo Stoakes --- include/linux/mm.h | 1 - mm/internal.h | 9 --------- mm/vma.c | 8 ++++++++ tools/testing/vma/shared.c | 9 --------- tools/testing/vma/shared.h | 5 ----- 5 files changed, 8 insertions(+), 24 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 3d69b597b9b1..762313b47301 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -4130,7 +4130,6 @@ void anon_rmap_tree_verify(struct anon_vma_chain *avc); /* mmap.c */ extern int __vm_enough_memory(const struct mm_struct *mm, long pages, int cap_sys_admin); -extern int insert_vm_struct(struct mm_struct *, struct vm_area_struct *); extern void exit_mmap(struct mm_struct *); bool mmap_read_lock_maybe_expand(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, bool write); diff --git a/mm/internal.h b/mm/internal.h index 01a762bcc2b2..2c650d280e90 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1540,15 +1540,6 @@ extern bool mirrored_kernelcore; bool memblock_has_mirror(void); void memblock_free_all(void); -static __always_inline void vma_set_range(struct vm_area_struct *vma, - unsigned long start, unsigned long end, - pgoff_t pgoff) -{ - vma->vm_start = start; - vma->vm_end = end; - vma->vm_pgoff = pgoff; -} - static inline bool vma_soft_dirty_enabled(struct vm_area_struct *vma) { /* diff --git a/mm/vma.c b/mm/vma.c index 5308aa5a8c91..cc0e449ad0be 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -70,6 +70,14 @@ struct mmap_state { .state = VMA_MERGE_START, \ } +static void vma_set_range(struct vm_area_struct *vma, unsigned long start, + unsigned long end, pgoff_t pgoff) +{ + vma->vm_start = start; + vma->vm_end = end; + vma->vm_pgoff = pgoff; +} + /* Was this VMA ever forked from a parent, i.e. maybe contains CoW mappings? */ static bool vma_is_fork_child(struct vm_area_struct *vma) { diff --git a/tools/testing/vma/shared.c b/tools/testing/vma/shared.c index 2565a5aecb80..bea9ea6db02a 100644 --- a/tools/testing/vma/shared.c +++ b/tools/testing/vma/shared.c @@ -120,12 +120,3 @@ unsigned long rlimit(unsigned int limit) { return (unsigned long)-1; } - -void vma_set_range(struct vm_area_struct *vma, - unsigned long start, unsigned long end, - pgoff_t pgoff) -{ - vma->vm_start = start; - vma->vm_end = end; - vma->vm_pgoff = pgoff; -} diff --git a/tools/testing/vma/shared.h b/tools/testing/vma/shared.h index 8b9e3b11c3cb..ca4f1238f1c7 100644 --- a/tools/testing/vma/shared.h +++ b/tools/testing/vma/shared.h @@ -125,8 +125,3 @@ void __vma_set_dummy_anon_vma(struct vm_area_struct *vma, /* Provide a simple dummy VMA/anon_vma dummy setup for testing. */ void vma_set_dummy_anon_vma(struct vm_area_struct *vma, struct anon_vma_chain *avc); - -/* Helper function to specify a VMA's range. */ -void vma_set_range(struct vm_area_struct *vma, - unsigned long start, unsigned long end, - pgoff_t pgoff); -- 2.55.0