From mboxrd@z Thu Jan 1 00:00:00 1970 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 DE257F506D9 for ; Mon, 16 Mar 2026 14:47:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HksiW8mwUIUUZeVN3IsR12TYHuTJXhGFLqIwf5UAG7k=; b=dcz4lvBFebp41/clxQ3TtSBTlm T8AY4UcpgQG0GWNIM70SmEI327+JQ7+ZnPrGd5FEWcw/hRTXjgncXllGqiEVmvmgfhL8Sk+oztcLU ecySCxRXorT09t/dx9R8wXyvL/5nVq7I7jklIA30tQWQD0ulcs9e0Ly70V0KMxF6uNCgGv+17Zf4E udVAPZlTSSwDx0C1Dhh2SSc7Epcwm9tPnGOb3sBzNKaVzEmqW2YapYHaRzfbJ6cJ1V5RlScn+TnHK s6oqnVNawlOav6npB2LH11r8sbyEVZG/7YfPBi1T/kxadYgPYhCyXxKq8XRKWx5Ar8tkYoUvWRrAI iz/vDxZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1w29EI-00000004EBA-3iG5; Mon, 16 Mar 2026 14:47:38 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1w29EF-00000004E8z-4B51; Mon, 16 Mar 2026 14:47:36 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 680A56012B; Mon, 16 Mar 2026 14:47:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C73DEC2BC87; Mon, 16 Mar 2026 14:47:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773672455; bh=SWyWovQpZcRYDA2RTZfFVXcBgJf/dKBAYGsO0cjwpR8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fBoPKg5akPio74rsRGXjA5HYsmf0U0scEYxrF9JlUrnKHGrjoBxvJmuqAcLCHgUoS IFCj8Q6ofjLHnZu+caNKOvyGbzv4zt5yp93PoYG0JqtHPeAHRWXKG7bs4UrW91MZHc AOTUOG75P0LPx53kTgiD9zdeSjGIjxfzeut773v0jtaoImyzhRkvHh9a/Uzr51SXfi gokr/3PW4cHZn0v/iCNUutyK7CIsTQk80ZURS3qpuz7koF3Fd9qNvUkuVpQG0yN/9k uONkj8w6MwBSTEMqIXQ4bc8ZhtmCxRAk5iXQW6PEviYet3WsvklRl6FBuzmcJmE6t0 4z2vm0eSfUFwA== Date: Mon, 16 Mar 2026 14:47:24 +0000 From: "Lorenzo Stoakes (Oracle)" To: Suren Baghdasaryan Cc: Andrew Morton , Jonathan Corbet , Clemens Ladisch , Arnd Bergmann , Greg Kroah-Hartman , "K . Y . Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Alexander Shishkin , Maxime Coquelin , Alexandre Torgue , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Bodo Stroesser , "Martin K . Petersen" , David Howells , Marc Dionne , Alexander Viro , Christian Brauner , Jan Kara , David Hildenbrand , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Michal Hocko , Jann Horn , Pedro Falcato , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-mtd@lists.infradead.org, linux-staging@lists.linux.dev, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Ryan Roberts Subject: Re: [PATCH 01/15] mm: various small mmap_prepare cleanups Message-ID: References: <56372fe273f775b26675a04652c1229e14680741.1773346620.git.ljs@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun, Mar 15, 2026 at 04:06:48PM -0700, Suren Baghdasaryan wrote: > > > --- a/include/linux/mm.h > > > +++ b/include/linux/mm.h > > > @@ -4116,10 +4116,10 @@ static inline void mmap_action_ioremap_full(struct vm_area_desc *desc, > > > mmap_action_ioremap(desc, desc->start, start_pfn, vma_desc_size(desc)); > > > } > > > > > > -void mmap_action_prepare(struct mmap_action *action, > > > - struct vm_area_desc *desc); > > > -int mmap_action_complete(struct mmap_action *action, > > > - struct vm_area_struct *vma); > > > +int mmap_action_prepare(struct vm_area_desc *desc, > > > + struct mmap_action *action); > > > +int mmap_action_complete(struct vm_area_struct *vma, > > > + struct mmap_action *action); > > > > > > /* Look up the first VMA which exactly match the interval vm_start ... vm_end */ > > > static inline struct vm_area_struct *find_exact_vma(struct mm_struct *mm, > > > diff --git a/mm/internal.h b/mm/internal.h > > > index 95b583e7e4f7..7bfa85b5e78b 100644 > > > --- a/mm/internal.h > > > +++ b/mm/internal.h > > > @@ -1775,26 +1775,32 @@ int walk_page_range_debug(struct mm_struct *mm, unsigned long start, > > > void dup_mm_exe_file(struct mm_struct *mm, struct mm_struct *oldmm); > > > int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm); > > > > > > -void remap_pfn_range_prepare(struct vm_area_desc *desc, unsigned long pfn); > > > -int remap_pfn_range_complete(struct vm_area_struct *vma, unsigned long addr, > > > - unsigned long pfn, unsigned long size, pgprot_t pgprot); > > > +int remap_pfn_range_prepare(struct vm_area_desc *desc, > > > + struct mmap_action *action); > > > +int remap_pfn_range_complete(struct vm_area_struct *vma, > > > + struct mmap_action *action); > > > > > > -static inline void io_remap_pfn_range_prepare(struct vm_area_desc *desc, > > > - unsigned long orig_pfn, unsigned long size) > > > +static inline int io_remap_pfn_range_prepare(struct vm_area_desc *desc, > > > + struct mmap_action *action) > > > { > > > + const unsigned long orig_pfn = action->remap.start_pfn; > > > + const unsigned long size = action->remap.size; > > > const unsigned long pfn = io_remap_pfn_range_pfn(orig_pfn, size); > > > > > > - return remap_pfn_range_prepare(desc, pfn); > > > + action->remap.start_pfn = pfn; > > > + return remap_pfn_range_prepare(desc, action); > > > } > > > > > > static inline int io_remap_pfn_range_complete(struct vm_area_struct *vma, > > > - unsigned long addr, unsigned long orig_pfn, unsigned long size, > > > - pgprot_t orig_prot) > > > + struct mmap_action *action) > > > { > > > - const unsigned long pfn = io_remap_pfn_range_pfn(orig_pfn, size); > > > - const pgprot_t prot = pgprot_decrypted(orig_prot); > > > + const unsigned long size = action->remap.size; > > > + const unsigned long orig_pfn = action->remap.start_pfn; > > > + const pgprot_t orig_prot = vma->vm_page_prot; > > > > > > - return remap_pfn_range_complete(vma, addr, pfn, size, prot); > > > + action->remap.pgprot = pgprot_decrypted(orig_prot); > > I'm guessing it doesn't really matter but after this change > action->remap.pgprot will store the decrypted value while before this > change it was kept the way mmap_prepare() originally set it. We pass > the action structure later to mmap_actpion_finish() but it does not use > action->remap.pgprot, so this probably doesn't matter. Yeah it doesn't really matter either way. Cheers, Lorenzo