[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3f565267-078e-ad4c-dfd2-36dba2201afe@suse.cz>
Date: Wed, 19 Jan 2022 17:51:37 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: Liam Howlett <liam.howlett@...cle.com>,
"maple-tree@...ts.infradead.org" <maple-tree@...ts.infradead.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Song Liu <songliubraving@...com>,
Davidlohr Bueso <dave@...olabs.net>,
"Paul E . McKenney" <paulmck@...nel.org>,
Matthew Wilcox <willy@...radead.org>,
Laurent Dufour <ldufour@...ux.ibm.com>,
David Rientjes <rientjes@...gle.com>,
Axel Rasmussen <axelrasmussen@...gle.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Rik van Riel <riel@...riel.com>,
Peter Zijlstra <peterz@...radead.org>,
Michel Lespinasse <walken.cr@...il.com>,
Jerome Glisse <jglisse@...hat.com>,
Minchan Kim <minchan@...gle.com>,
Joel Fernandes <joelaf@...gle.com>,
Rom Lemarchand <romlem@...gle.com>
Subject: Re: [PATCH v4 48/66] fork: Use VMA iterator
On 12/1/21 15:30, Liam Howlett wrote:
> From: "Liam R. Howlett" <Liam.Howlett@...cle.com>
>
> The VMA iterator is faster than the linked list and removing the linked
> list will shrink the vm_area_struct.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
> Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
Acked-by: Vlastimil Babka <vbabka@...e.cz>
> ---
> kernel/fork.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/fork.c b/kernel/fork.c
> index 3493117c8d35..6de302e93519 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -1228,13 +1228,16 @@ int replace_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file)
> /* Forbid mm->exe_file change if old file still mapped. */
> old_exe_file = get_mm_exe_file(mm);
> if (old_exe_file) {
> + VMA_ITERATOR(vmi, mm, 0);
> mmap_read_lock(mm);
> - for (vma = mm->mmap; vma && !ret; vma = vma->vm_next) {
> + for_each_vma(vmi, vma) {
> if (!vma->vm_file)
> continue;
> if (path_equal(&vma->vm_file->f_path,
> - &old_exe_file->f_path))
> + &old_exe_file->f_path)) {
> ret = -EBUSY;
> + break;
> + }
> }
> mmap_read_unlock(mm);
> fput(old_exe_file);
Powered by blists - more mailing lists