Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/vma: remove superfluous map->hold_file_rmap_lock

We don't need to reference this field, it's confusing as it duplicates
mmap_action->hide_from_rmap_until_complete, so thread the mmap_action
through to __mmap_new_vma() instead and use the same field consistently.

Link: https://lkml.kernel.org/r/42c3fbb701e361a17193ecda0d2dabcc326288a5.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>

authored by

Lorenzo Stoakes (Oracle) and committed by
Andrew Morton
04501e75 33506d4b

+6 -8
+6 -8
mm/vma.c
··· 38 38 39 39 /* Determine if we can check KSM flags early in mmap() logic. */ 40 40 bool check_ksm_early :1; 41 - /* If we map new, hold the file rmap lock on mapping. */ 42 - bool hold_file_rmap_lock :1; 43 41 /* If .mmap_prepare changed the file, we don't need to pin. */ 44 42 bool file_doesnt_need_get :1; 45 43 }; ··· 2528 2530 * 2529 2531 * @map: Mapping state. 2530 2532 * @vmap: Output pointer for the new VMA. 2533 + * @action: Any mmap_prepare action that is still to complete. 2531 2534 * 2532 2535 * Returns: Zero on success, or an error. 2533 2536 */ 2534 - static int __mmap_new_vma(struct mmap_state *map, struct vm_area_struct **vmap) 2537 + static int __mmap_new_vma(struct mmap_state *map, struct vm_area_struct **vmap, 2538 + struct mmap_action *action) 2535 2539 { 2536 2540 struct vma_iterator *vmi = map->vmi; 2537 2541 int error = 0; ··· 2582 2582 vma_start_write(vma); 2583 2583 vma_iter_store_new(vmi, vma); 2584 2584 map->mm->map_count++; 2585 - vma_link_file(vma, map->hold_file_rmap_lock); 2585 + vma_link_file(vma, action->hide_from_rmap_until_complete); 2586 2586 2587 2587 /* 2588 2588 * vma_merge_new_range() calls khugepaged_enter_vma() too, the below ··· 2649 2649 if (err) 2650 2650 return err; 2651 2651 2652 - if (desc->action.hide_from_rmap_until_complete) 2653 - map->hold_file_rmap_lock = true; 2654 2652 return 0; 2655 2653 } 2656 2654 ··· 2738 2740 err = mmap_action_complete(vma, action); 2739 2741 2740 2742 /* If we held the file rmap we need to release it. */ 2741 - if (map->hold_file_rmap_lock) { 2743 + if (action->hide_from_rmap_until_complete) { 2742 2744 struct file *file = vma->vm_file; 2743 2745 2744 2746 i_mmap_unlock_write(file->f_mapping); ··· 2792 2794 2793 2795 /* ...but if we can't, allocate a new VMA. */ 2794 2796 if (!vma) { 2795 - error = __mmap_new_vma(&map, &vma); 2797 + error = __mmap_new_vma(&map, &vma, &desc.action); 2796 2798 if (error) 2797 2799 goto unacct_error; 2798 2800 allocated_new = true;