]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mm: document vm_operations_struct->open the same as close()
authorLorenzo Stoakes (Oracle) <ljs@kernel.org>
Fri, 20 Mar 2026 22:39:29 +0000 (22:39 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 5 Apr 2026 20:53:42 +0000 (13:53 -0700)
Describe when the operation is invoked and the context in which it is
invoked, matching the description already added for vm_op->close().

While we're here, update all outdated references to an 'area' field for
VMAs to the more consistent 'vma'.

Link: https://lkml.kernel.org/r/7d0ca833c12014320f0fa00f816f95e6e10076f2.1774045440.git.ljs@kernel.org
Signed-off-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Bodo Stroesser <bostroesser@gmail.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: David Hildenbrand <david@kernel.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jann Horn <jannh@google.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Long Li <longli@microsoft.com>
Cc: Marc Dionne <marc.dionne@auristor.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: Richard Weinberger <richard@nod.at>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vignesh Raghavendra <vigneshr@ti.com>
Cc: Wei Liu <wei.liu@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/mm.h
tools/testing/vma/include/dup.h

index 6ca2fc5ae83fc639c52f0cb8106d360561d04fe8..21a2eef5f8fee5014b5bee0854d94eb6685e344b 100644 (file)
@@ -764,15 +764,20 @@ struct vm_fault {
  * to the functions called when a no-page or a wp-page exception occurs.
  */
 struct vm_operations_struct {
-       void (*open)(struct vm_area_struct * area);
+       /**
+        * @open: Called when a VMA is remapped, split or forked. Not called
+        * upon first mapping a VMA.
+        * Context: User context.  May sleep.  Caller holds mmap_lock.
+        */
+       void (*open)(struct vm_area_struct *vma);
        /**
         * @close: Called when the VMA is being removed from the MM.
         * Context: User context.  May sleep.  Caller holds mmap_lock.
         */
-       void (*close)(struct vm_area_struct * area);
+       void (*close)(struct vm_area_struct *vma);
        /* Called any time before splitting to check if it's allowed */
-       int (*may_split)(struct vm_area_struct *area, unsigned long addr);
-       int (*mremap)(struct vm_area_struct *area);
+       int (*may_split)(struct vm_area_struct *vma, unsigned long addr);
+       int (*mremap)(struct vm_area_struct *vma);
        /*
         * Called by mprotect() to make driver-specific permission
         * checks before mprotect() is finalised.   The VMA must not
@@ -784,7 +789,7 @@ struct vm_operations_struct {
        vm_fault_t (*huge_fault)(struct vm_fault *vmf, unsigned int order);
        vm_fault_t (*map_pages)(struct vm_fault *vmf,
                        pgoff_t start_pgoff, pgoff_t end_pgoff);
-       unsigned long (*pagesize)(struct vm_area_struct * area);
+       unsigned long (*pagesize)(struct vm_area_struct *vma);
 
        /* notification that a previously read-only page is about to become
         * writable, if an error is returned it will cause a SIGBUS */
index e7581efaf470ba979546e4e7641f27c18fff9b3b..5bc04c801504fd19aa98bf2b959509f591c22d42 100644 (file)
@@ -632,15 +632,20 @@ struct vm_area_struct {
 } __randomize_layout;
 
 struct vm_operations_struct {
-       void (*open)(struct vm_area_struct * area);
+       /**
+        * @open: Called when a VMA is remapped, split or forked. Not called
+        * upon first mapping a VMA.
+        * Context: User context.  May sleep.  Caller holds mmap_lock.
+        */
+       void (*open)(struct vm_area_struct *vma);
        /**
         * @close: Called when the VMA is being removed from the MM.
         * Context: User context.  May sleep.  Caller holds mmap_lock.
         */
-       void (*close)(struct vm_area_struct * area);
+       void (*close)(struct vm_area_struct *vma);
        /* Called any time before splitting to check if it's allowed */
-       int (*may_split)(struct vm_area_struct *area, unsigned long addr);
-       int (*mremap)(struct vm_area_struct *area);
+       int (*may_split)(struct vm_area_struct *vma, unsigned long addr);
+       int (*mremap)(struct vm_area_struct *vma);
        /*
         * Called by mprotect() to make driver-specific permission
         * checks before mprotect() is finalised.   The VMA must not
@@ -652,7 +657,7 @@ struct vm_operations_struct {
        vm_fault_t (*huge_fault)(struct vm_fault *vmf, unsigned int order);
        vm_fault_t (*map_pages)(struct vm_fault *vmf,
                        pgoff_t start_pgoff, pgoff_t end_pgoff);
-       unsigned long (*pagesize)(struct vm_area_struct * area);
+       unsigned long (*pagesize)(struct vm_area_struct *vma);
 
        /* notification that a previously read-only page is about to become
         * writable, if an error is returned it will cause a SIGBUS */