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 8CA8239099E; Thu, 16 Jul 2026 09:44:48 +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=1784195089; cv=none; b=RvzvyCrRmOz5mf63GUV3b9ZA4rUntQ0pJF7DziEjgY10t+VudHG4/Y6ytavYIu1SfbJoKqECCcsSWXNox0Ga5pHAnvHXwbNhcMJ8DIwTBvribg0rnFGAMWZ8+6VHQmUkeIoBhwE8O1tDLgPN2vuK5WEXINM/XS2m7yYvSBwBoTA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784195089; c=relaxed/simple; bh=XPmKMoextM/HFj/oZo16bN5hUEYExnGBNdAQnn255lg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cpNup3FRuDm9ZC5PMvQl2bm1jz44bJMdRb/ViEiIDKdeT6o2ZN0qFLSrWt0BwEG9qh/+Gndwu3aWimH2/DZVidXXG5KMjr5PJCJtRZFUqNK1m56YWI1t5sxuiFllSxcBmy0NfBVw2xoSAJoJjq3Kruo5VulgdYeQuUMuhC1XXEQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=P6J+5xgM; 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="P6J+5xgM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1D761F000E9; Thu, 16 Jul 2026 09:44:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784195088; bh=dmYCCccZvFya5IfQO9umLSlG7KA9XHfnAyi29IizQrE=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=P6J+5xgMjqQhZg4SZJraBPZaPv2e6+jOxcujMrUEOUgldmEur9LTBYnzHRap/ieCI 9NOwwquOSB20wUe0GRV8tW2roBWIsNqhxmJlQvBzZFSaMKY1QF2JQIvNmCCPrUM7iV LfHSG1T9SdIpLgfUbTSAD88RrIfs70n11jj+F4BvKYlS/wW4aravTdaDp5gV8A5yh2 pcFKQy+Kz7kscIo+8APeLjADhi+Y3RDAqou8RidssxxD5lL1lwrEXrJXISKpcjUNrm S6bs3AZyFeqOKgkXC/0feAjqhK7saLvCqjsUGDSJrRLKonf3Wtvl8C7U/JCrc7ZB6N BHR3yn+DYVx+Q== Date: Thu, 16 Jul 2026 10:44:14 +0100 From: "Lorenzo Stoakes (ARM)" To: "Liam R. Howlett" Cc: Andrew Morton , David Hildenbrand , 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 , 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 Subject: Re: [PATCH v2 01/33] mm: move vma_start_pgoff() into mm.h and clean up Message-ID: References: <20260710-b4-pre-scalable-cow-v2-0-2a5aa403d977@kernel.org> <20260710-b4-pre-scalable-cow-v2-1-2a5aa403d977@kernel.org> Precedence: bulk X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Jul 15, 2026 at 02:05:42PM -0400, Liam R. Howlett wrote: > On 26/07/10 09:16PM, Lorenzo Stoakes wrote: > > vma_last_pgoff() already lives there, so it's a bit odd to keep > > vma_start_pgoff() in mm/interval_tree.c. Move them together. > > > > These each return unsigned long, which pgoff_t is typedef'd to. Make this > > consistent and have these functions return pgoff_t instead. > > > > Additionally, express vma_last_pgoff() in terms of vma_start_pgoff(), since > > we wrap the vma->vm_pgoff access, we may as well use it here. > > > > Also while we're here, const-ify the VMA and cleanup a bit. > > > > Also update the VMA userland tests to reflect the change. > > This patch could have been 01/35? Disappointing, but I will try to get > over it. ;) well I have a series I've not sent yet that maybe could grow a bit to achieve these aims? :>) > > > > > No functional change intended. > > > > Reviewed-by: Gregory Price > > Acked-by: David Hildenbrand (Arm) > > Reviewed-by: Pedro Falcato > > Reviewed-by: Vlastimil Babka (SUSE) > > Signed-off-by: Lorenzo Stoakes > > Reviewed-by: Liam R. Howlett (Oracle) Thanks! > > > --- > > include/linux/mm.h | 9 +++++++-- > > mm/interval_tree.c | 5 ----- > > tools/testing/vma/include/dup.h | 5 +++++ > > 3 files changed, 12 insertions(+), 7 deletions(-) > > > > diff --git a/include/linux/mm.h b/include/linux/mm.h > > index 25e669632d2c..09b06d8fea74 100644 > > --- a/include/linux/mm.h > > +++ b/include/linux/mm.h > > @@ -4307,9 +4307,14 @@ static inline unsigned long vma_pages(const struct vm_area_struct *vma) > > return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; > > } > > > > -static inline unsigned long vma_last_pgoff(struct vm_area_struct *vma) > > +static inline pgoff_t vma_start_pgoff(const struct vm_area_struct *vma) > > { > > - return vma->vm_pgoff + vma_pages(vma) - 1; > > + return vma->vm_pgoff; > > +} > > + > > +static inline pgoff_t vma_last_pgoff(const struct vm_area_struct *vma) > > +{ > > + return vma_start_pgoff(vma) + vma_pages(vma) - 1; > > } > > > > static inline unsigned long vma_desc_size(const struct vm_area_desc *desc) > > diff --git a/mm/interval_tree.c b/mm/interval_tree.c > > index 32bcfbfcf15f..344d1f5946c7 100644 > > --- a/mm/interval_tree.c > > +++ b/mm/interval_tree.c > > @@ -10,11 +10,6 @@ > > #include > > #include > > > > -static inline unsigned long vma_start_pgoff(struct vm_area_struct *v) > > -{ > > - return v->vm_pgoff; > > -} > > - > > INTERVAL_TREE_DEFINE(struct vm_area_struct, shared.rb, > > unsigned long, shared.rb_subtree_last, > > vma_start_pgoff, vma_last_pgoff, /* empty */, vma_interval_tree) > > diff --git a/tools/testing/vma/include/dup.h b/tools/testing/vma/include/dup.h > > index bf26b3f48d3a..668650067c7c 100644 > > --- a/tools/testing/vma/include/dup.h > > +++ b/tools/testing/vma/include/dup.h > > @@ -1301,6 +1301,11 @@ static inline unsigned long vma_pages(const struct vm_area_struct *vma) > > return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; > > } > > > > +static inline pgoff_t vma_start_pgoff(const struct vm_area_struct *vma) > > +{ > > + return vma->vm_pgoff; > > +} > > + > > static inline int vfs_mmap_prepare(struct file *file, struct vm_area_desc *desc) > > { > > return file->f_op->mmap_prepare(desc); > > > > -- > > 2.55.0 > > Cheers, Lorenzo