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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 18150106ACE5 for ; Thu, 12 Mar 2026 20:28:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7A8EA6B00AD; Thu, 12 Mar 2026 16:28:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 745B66B00B0; Thu, 12 Mar 2026 16:28:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 654726B00B1; Thu, 12 Mar 2026 16:28:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 4E4396B00AD for ; Thu, 12 Mar 2026 16:28:20 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 097D65873B for ; Thu, 12 Mar 2026 20:28:20 +0000 (UTC) X-FDA: 84538548360.05.08C9DC5 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf29.hostedemail.com (Postfix) with ESMTP id 3FBAC120005 for ; Thu, 12 Mar 2026 20:28:18 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=MJPUE92g; spf=pass (imf29.hostedemail.com: domain of ljs@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=ljs@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1773347298; 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=WOfSKoGsUUqTeX7EoAP25IT9v7QqwfQZofiFpIRo5SI=; b=LXvsO3vsbbAlMaVQ42NG4OsYWgvEnZke6lYjxw/FwcaoaFpUcwps4kcUdWGveK8Wg8AefI xb3j4Y4vZzl+5D2ftv0ExeN7gOdbBv4F9RZ5TDfR8w7BvxL1I8+OyS3vx6T44JTDmGqUgY AntpBqFgZTSbbEc/96I1Uv5fZFzvdD8= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=MJPUE92g; spf=pass (imf29.hostedemail.com: domain of ljs@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=ljs@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1773347298; a=rsa-sha256; cv=none; b=giwJ9IJgzRc+gOQ1CQo3k+RTRqQbcG8h3estVfc4W5Ziz57B1TF//pdgRhc5+KPB98KMPO gyNkBFsvF7xy80eyAFAMntLnG9O67OnwBh4IMY15MIqOx+ZxPw9PpLXxuAO6SXbdZQ7UL/ VQIFxBjw3ek0sQRco4poZ7eEooltLBo= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 43B7E4454F; Thu, 12 Mar 2026 20:28:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90997C2BC9E; Thu, 12 Mar 2026 20:28:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773347297; bh=IQ9CcOj4/wb8X3pfUbsOqwcAPjdrHvR/Ywvl6q86aCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MJPUE92g7+GGHjinCxCy+uvh74u0SqP/YHPLUUy4+IA4LP6fAN0pmzE+WLbP9dbSg MI4XMQh/9YT2/dxj+xftUmKw6wiBfnymgZ1mN/ds6XP9mCoOilq3z4qbUd0ab4PEzj ZKMqSK2zrWldtSaPG7aSuNX3gT/AeuGVgip0bKhQ56Vio6e2WTdyks54QCLnMlGT8z 55SKkseJTeuZ5AW6oRG5c1dU6LVrZ5hOlg4PpYudzSbrZQdowOEVtwhIOy33bY45gy Z7npKE+Ht/B4ED0Ufrh3qC9YHGTvnZ6U/YPo/0418nl8w+1u2QKKwstFLSlkY6gquf hnb0H9yQKXrRQ== From: "Lorenzo Stoakes (Oracle)" To: Andrew Morton Cc: 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 , Suren Baghdasaryan , 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: [PATCH 12/15] mm: allow handling of stacked mmap_prepare hooks in more drivers Date: Thu, 12 Mar 2026 20:27:27 +0000 Message-ID: X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Queue-Id: 3FBAC120005 X-Rspamd-Server: rspam08 X-Stat-Signature: 8bz4j7w3z5brpqdsc671miiyc8yqg8y3 X-HE-Tag: 1773347298-856221 X-HE-Meta: U2FsdGVkX1+v1emCFzB7PwQCtNVyU1Nz/xrrIAwbQlZnruRxaKR4mOC0tFjKhFNIURjVUQo9HRE335SAhvY22J6QlnbBgvgr6SMWmyFdLoR2ZXtjQahhioB6DOpeF6u2f/5xsOYxTiLL4GjB6y6bqhwXMAwGNdj0S9u0BqaA82jVCSBBIEMnTXrokQkw+eMsJ8I8Q5pzfVB+uN3RCr+V3B7tYbWmKGXvL4r4VSk2mEhuNud6BRSUF8Rdng8ex5eFYpPBMDGSspuaTy17JVaTVZDLUwrlK7yKbqSkVebamrL65au8QsO6z6LnB9fv7BYvJPBWg67g3hF36fWwCvLHWrvRwvXGhylJrFm59fgxszxV+CRJLBtm0KzaIdOIw+I2Mx1/lpo2wvFWrE/RKtoQeKhAmXdf9bvIV5Jifzt0h61a+lAMXm85Xdx005vhj2tuaoreIKT+9lbToc8VzJylQGvrMnp7pc9ctLnPXAyb1UL0oIkPfCkxqFJxC+wNhr6O0Uff4akz5SJX1cU/CQ1nNIvgp2HmBkSDXnZ5EmXuQwTYTndj06I5yFGgGAikj2UxZ/CAwPHNJOCf/32OIP71ZhBa5JJMcbUvfiVg/OjbvlZmM58iVn8v4p1b8jJ7M18JsiXnzT0dUOXxgp4DtWjNlnIX2g6x4nX8ycJlEwu/CfgXfhhS0H3i+RaE9CBQVAdhg4CIQVhx76UNxxhjK09eN/0CZui/tDKV0x6B9FtyB6DxYcFaIgRLB1SoTTWtn5GDI9Zzi/jrIJlMMSc+UuEEJBrxT4p5HV/vYu6W/60EOezfKGv9dFWojid3BWCynBvFnimAP7f0voo8ROO4qWznhql5ObEQTa9bNmpUXYnaPXRybooTA3Dpwe1rzvNgoOEOJtdF44RA8lbSWQ6KEFgA/wodLMbIXO6bcUtI0hUWrwv5rSuqca6r0XkoJ9Q5T+bUXsMP90awllCy9BYi55i GwRNlhTG gm8qoM9dtLh7sj2025Sy/G1slwzJgY8lKk3lJQs2dZZK1PvAs4NAr9NUXwfMSZHErGnaioUybDaHmHUQMgDyweH75WCnLJylUHUHHiEBTR62YezL6hGIOoYhMFbD+PVJAOiaE+8DpGeTalfoTIyOQcFD4FoQJxch/syWXRI6qZdI1xz5OVDm5D3cWikvq3yIjoqwZpEVRKnXM3qG4HcChfZB/ZEulY00yZg662T5NxfFX5NPMYYzNmkcxEZy/TnvVd9m1R6n75xaRuLYszckJY5jVqT8DS+r1xUI9ktckNF0AX69UfcMmsW5QoQnQiV5PIrxU Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: While the conversion of mmap hooks to mmap_prepare is underway, we wil encounter situations where mmap hooks need to invoke nested mmap_prepare hooks. The nesting of mmap hooks is termed 'stacking'. In order to flexibly facilitate the conversion of custom mmap hooks in drivers which stack, we must split up the existing compat_vma_mapped() function into two separate functions: * compat_set_desc_from_vma() - This allows the setting of a vm_area_desc object's fields to the relevant fields of a VMA. * __compat_vma_mmap() - Once an mmap_prepare hook has been executed upon a vm_area_desc object, this function performs any mmap actions specified by the mmap_prepare hook and then invokes its vm_ops->mapped() hook if any were specified. In ordinary cases, where a file's f_op->mmap_prepare() hook simply needs to be invoked in a stacked mmap() hook, compat_vma_mmap() can be used. However some drivers define their own nested hooks, which are invoked in turn by another hook. A concrete example is vmbus_channel->mmap_ring_buffer(), which is invoked in turn by bin_attribute->mmap(): vmbus_channel->mmap_ring_buffer() has a signature of: int (*mmap_ring_buffer)(struct vmbus_channel *channel, struct vm_area_struct *vma); And bin_attribute->mmap() has a signature of: int (*mmap)(struct file *, struct kobject *, const struct bin_attribute *attr, struct vm_area_struct *vma); And so compat_vma_mmap() cannot be used here for incremental conversion of hooks from mmap() to mmap_prepare(). There are many such instances like this, where conversion to mmap_prepare would otherwise cascade to a huge change set due to nesting of this kind. The changes in this patch mean we could now instead convert vmbus_channel->mmap_ring_buffer() to vmbus_channel->mmap_prepare_ring_buffer(), and implement something like: struct vm_area_desc desc; int err; compat_set_desc_from_vm(&desc, file, vma); err = channel->mmap_prepare_ring_buffer(channel, &desc); if (err) return err; return __compat_vma_mmap(&desc, vma); Allowing us to incrementally update this logic, and other logic like it. Unfortunately, as part of this change, we need to be able to flexibly assign to the VMA descriptor, so have to remove some of the const declarations within the structure. Also update the VMA tests to reflect the changes. Signed-off-by: Lorenzo Stoakes (Oracle) --- include/linux/fs.h | 3 + include/linux/mm_types.h | 4 +- mm/util.c | 111 +++++++++++++++++++++++--------- mm/vma.h | 2 +- tools/testing/vma/include/dup.h | 111 ++++++++++++++++++++------------ 5 files changed, 157 insertions(+), 74 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index c390f5c667e3..0bdccfa70b44 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2058,6 +2058,9 @@ static inline bool can_mmap_file(struct file *file) return true; } +void compat_set_desc_from_vma(struct vm_area_desc *desc, const struct file *file, + const struct vm_area_struct *vma); +int __compat_vma_mmap(struct vm_area_desc *desc, struct vm_area_struct *vma); int compat_vma_mmap(struct file *file, struct vm_area_struct *vma); int __vma_check_mmap_hook(struct vm_area_struct *vma); diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 1c94db0fcfb4..316bb0adf91d 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -883,8 +883,8 @@ typedef struct { */ struct vm_area_desc { /* Immutable state. */ - const struct mm_struct *const mm; - struct file *const file; /* May vary from vm_file in stacked callers. */ + struct mm_struct *mm; + struct file *file; /* May vary from vm_file in stacked callers. */ unsigned long start; unsigned long end; diff --git a/mm/util.c b/mm/util.c index 3205bb9ab5d2..e739d7c0311c 100644 --- a/mm/util.c +++ b/mm/util.c @@ -1163,34 +1163,38 @@ void flush_dcache_folio(struct folio *folio) EXPORT_SYMBOL(flush_dcache_folio); #endif -static int __compat_vma_mmap(struct file *file, struct vm_area_struct *vma) +/** + * compat_set_desc_from_vma() - assigns VMA descriptor @desc fields from a VMA. + * @desc: A VMA descriptor whose fields need to be set. + * @file: The file object describing the file being mmap()'d. + * @vma: The VMA whose fields we wish to assign to @desc. + * + * This is a compatibility function to allow an mmap() hook to call + * mmap_prepare() hooks when drivers nest these. This function specifically + * allows the construction of a vm_area_desc value, @desc, from a VMA @vma for + * the purposes of doing this. + * + * Once the conversion of drivers is complete this function will no longer be + * required and will be removed. + */ +void compat_set_desc_from_vma(struct vm_area_desc *desc, + const struct file *file, + const struct vm_area_struct *vma) { - struct vm_area_desc desc = { - .mm = vma->vm_mm, - .file = file, - .start = vma->vm_start, - .end = vma->vm_end, - - .pgoff = vma->vm_pgoff, - .vm_file = vma->vm_file, - .vma_flags = vma->flags, - .page_prot = vma->vm_page_prot, - - .action.type = MMAP_NOTHING, /* Default */ - }; - int err; + desc->mm = vma->vm_mm; + desc->file = (struct file *)file; + desc->start = vma->vm_start; + desc->end = vma->vm_end; - err = vfs_mmap_prepare(file, &desc); - if (err) - return err; + desc->pgoff = vma->vm_pgoff; + desc->vm_file = vma->vm_file; + desc->vma_flags = vma->flags; + desc->page_prot = vma->vm_page_prot; - err = mmap_action_prepare(&desc, &desc.action); - if (err) - return err; - - set_vma_from_desc(vma, &desc); - return mmap_action_complete(vma, &desc.action); + /* Default. */ + desc->action.type = MMAP_NOTHING; } +EXPORT_SYMBOL(compat_set_desc_from_vma); static int __compat_vma_mapped(struct file *file, struct vm_area_struct *vma) { @@ -1212,6 +1216,49 @@ static int __compat_vma_mapped(struct file *file, struct vm_area_struct *vma) return err; } +/** + * __compat_vma_mmap() - Similar to compat_vma_mmap(), only it allows + * flexibility as to how the mmap_prepare callback is invoked, which is useful + * for drivers which invoke nested mmap_prepare callbacks in an mmap() hook. + * @desc: A VMA descriptor upon which an mmap_prepare() hook has already been + * executed. + * @vma: The VMA to which @desc should be applied. + * + * The function assumes that you have obtained a VMA descriptor @desc from + * compt_set_desc_from_vma(), and already executed the mmap_prepare() hook upon + * it. + * + * It then performs any specified mmap actions, and invokes the vm_ops->mapped() + * hook if one is present. + * + * See the description of compat_vma_mmap() for more details. + * + * Once the conversion of drivers is complete this function will no longer be + * required and will be removed. + * + * Returns: 0 on success or error. + */ +int __compat_vma_mmap(struct vm_area_desc *desc, + struct vm_area_struct *vma) +{ + int err; + + /* Perform any preparatory tasks for mmap action. */ + err = mmap_action_prepare(desc, &desc->action); + if (err) + return err; + /* Update the VMA from the descriptor. */ + compat_set_vma_from_desc(vma, desc); + /* Complete any specified mmap actions. */ + err = mmap_action_complete(vma, &desc->action); + if (err) + return err; + + /* Invoke vm_ops->mapped callback. */ + return __compat_vma_mapped(desc->file, vma); +} +EXPORT_SYMBOL(__compat_vma_mmap); + /** * compat_vma_mmap() - Apply the file's .mmap_prepare() hook to an * existing VMA and execute any requested actions. @@ -1219,10 +1266,10 @@ static int __compat_vma_mapped(struct file *file, struct vm_area_struct *vma) * @vma: The VMA to apply the .mmap_prepare() hook to. * * Ordinarily, .mmap_prepare() is invoked directly upon mmap(). However, certain - * stacked filesystems invoke a nested mmap hook of an underlying file. + * stacked drivers invoke a nested mmap hook of an underlying file. * - * Until all filesystems are converted to use .mmap_prepare(), we must be - * conservative and continue to invoke these stacked filesystems using the + * Until all drivers are converted to use .mmap_prepare(), we must be + * conservative and continue to invoke these stacked drivers using the * deprecated .mmap() hook. * * However we have a problem if the underlying file system possesses an @@ -1233,20 +1280,22 @@ static int __compat_vma_mapped(struct file *file, struct vm_area_struct *vma) * establishes a struct vm_area_desc descriptor, passes to the underlying * .mmap_prepare() hook and applies any changes performed by it. * - * Once the conversion of filesystems is complete this function will no longer - * be required and will be removed. + * Once the conversion of drivers is complete this function will no longer be + * required and will be removed. * * Returns: 0 on success or error. */ int compat_vma_mmap(struct file *file, struct vm_area_struct *vma) { + struct vm_area_desc desc; int err; - err = __compat_vma_mmap(file, vma); + compat_set_desc_from_vma(&desc, file, vma); + err = vfs_mmap_prepare(file, &desc); if (err) return err; - return __compat_vma_mapped(file, vma); + return __compat_vma_mmap(&desc, vma); } EXPORT_SYMBOL(compat_vma_mmap); diff --git a/mm/vma.h b/mm/vma.h index eba388c61ef4..4a8dc5d15d47 100644 --- a/mm/vma.h +++ b/mm/vma.h @@ -296,7 +296,7 @@ static inline int vma_iter_store_gfp(struct vma_iterator *vmi, * f_op->mmap() but which might have an underlying file system which implements * f_op->mmap_prepare(). */ -static inline void set_vma_from_desc(struct vm_area_struct *vma, +static inline void compat_set_vma_from_desc(struct vm_area_struct *vma, struct vm_area_desc *desc) { /* diff --git a/tools/testing/vma/include/dup.h b/tools/testing/vma/include/dup.h index f95c4b8af03c..4f2c9bb6b1ea 100644 --- a/tools/testing/vma/include/dup.h +++ b/tools/testing/vma/include/dup.h @@ -490,8 +490,8 @@ enum vma_operation { */ struct vm_area_desc { /* Immutable state. */ - const struct mm_struct *const mm; - struct file *const file; /* May vary from vm_file in stacked callers. */ + struct mm_struct *mm; + struct file *file; /* May vary from vm_file in stacked callers. */ unsigned long start; unsigned long end; @@ -1118,43 +1118,92 @@ static inline void vma_set_anonymous(struct vm_area_struct *vma) } /* Declared in vma.h. */ -static inline void set_vma_from_desc(struct vm_area_struct *vma, +static inline void compat_set_vma_from_desc(struct vm_area_struct *vma, struct vm_area_desc *desc); -static inline int __compat_vma_mmap(const struct file_operations *f_op, - struct file *file, struct vm_area_struct *vma) +static inline void compat_set_desc_from_vma(struct vm_area_desc *desc, + const struct file *file, + const struct vm_area_struct *vma) { - struct vm_area_desc desc = { - .mm = vma->vm_mm, - .file = file, - .start = vma->vm_start, - .end = vma->vm_end, + desc->mm = vma->vm_mm; + desc->file = (struct file *)file; + desc->start = vma->vm_start; + desc->end = vma->vm_end; - .pgoff = vma->vm_pgoff, - .vm_file = vma->vm_file, - .vma_flags = vma->flags, - .page_prot = vma->vm_page_prot, + desc->pgoff = vma->vm_pgoff; + desc->vm_file = vma->vm_file; + desc->vma_flags = vma->flags; + desc->page_prot = vma->vm_page_prot; - .action.type = MMAP_NOTHING, /* Default */ - }; + /* Default. */ + desc->action.type = MMAP_NOTHING; +} + +static inline unsigned long vma_pages(const struct vm_area_struct *vma) +{ + return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; +} + +static inline void unmap_vma_locked(struct vm_area_struct *vma) +{ + const size_t len = vma_pages(vma) << PAGE_SHIFT; + + mmap_assert_locked(vma->vm_mm); + do_munmap(vma->vm_mm, vma->vm_start, len, NULL); +} + +static inline int __compat_vma_mapped(struct file *file, struct vm_area_struct *vma) +{ + const struct vm_operations_struct *vm_ops = vma->vm_ops; int err; - err = f_op->mmap_prepare(&desc); + if (!vm_ops->mapped) + return 0; + + err = vm_ops->mapped(vma->vm_start, vma->vm_end, vma->vm_pgoff, file, + &vma->vm_private_data); if (err) - return err; + unmap_vma_locked(vma); + return err; +} - err = mmap_action_prepare(&desc, &desc.action); +static inline int __compat_vma_mmap(struct vm_area_desc *desc, + struct vm_area_struct *vma) +{ + int err; + + /* Perform any preparatory tasks for mmap action. */ + err = mmap_action_prepare(desc, &desc->action); + if (err) + return err; + /* Update the VMA from the descriptor. */ + compat_set_vma_from_desc(vma, desc); + /* Complete any specified mmap actions. */ + err = mmap_action_complete(vma, &desc->action); if (err) return err; - set_vma_from_desc(vma, &desc); - return mmap_action_complete(vma, &desc.action); + /* Invoke vm_ops->mapped callback. */ + return __compat_vma_mapped(desc->file, vma); +} + +static inline int vfs_mmap_prepare(struct file *file, struct vm_area_desc *desc) +{ + return file->f_op->mmap_prepare(desc); } static inline int compat_vma_mmap(struct file *file, struct vm_area_struct *vma) { - return __compat_vma_mmap(file->f_op, file, vma); + struct vm_area_desc desc; + int err; + + compat_set_desc_from_vma(&desc, file, vma); + err = vfs_mmap_prepare(file, &desc); + if (err) + return err; + + return __compat_vma_mmap(&desc, vma); } @@ -1164,11 +1213,6 @@ static inline void vma_iter_init(struct vma_iterator *vmi, mas_init(&vmi->mas, &mm->mm_mt, addr); } -static inline unsigned long vma_pages(struct vm_area_struct *vma) -{ - return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; -} - static inline void mmap_assert_locked(struct mm_struct *); static inline struct vm_area_struct *find_vma_intersection(struct mm_struct *mm, unsigned long start_addr, @@ -1359,11 +1403,6 @@ static inline int vfs_mmap(struct file *file, struct vm_area_struct *vma) return file->f_op->mmap(file, vma); } -static inline int vfs_mmap_prepare(struct file *file, struct vm_area_desc *desc) -{ - return file->f_op->mmap_prepare(desc); -} - static inline void vma_set_file(struct vm_area_struct *vma, struct file *file) { /* Changing an anonymous vma with this is illegal */ @@ -1371,11 +1410,3 @@ static inline void vma_set_file(struct vm_area_struct *vma, struct file *file) swap(vma->vm_file, file); fput(file); } - -static inline void unmap_vma_locked(struct vm_area_struct *vma) -{ - const size_t len = vma_pages(vma) << PAGE_SHIFT; - - mmap_assert_locked(vma->vm_mm); - do_munmap(vma->vm_mm, vma->vm_start, len, NULL); -} -- 2.53.0