[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fee66042-29d1-15b3-ff99-f234d4537dba@suse.cz>
Date: Wed, 19 Jan 2022 17:47:27 +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 46/66] perf: 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/events/core.c | 3 ++-
> kernel/events/uprobes.c | 9 ++++++---
> 2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 523106a506ee..d839ba79fe5c 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -10218,8 +10218,9 @@ static void perf_addr_filter_apply(struct perf_addr_filter *filter,
> struct perf_addr_filter_range *fr)
> {
> struct vm_area_struct *vma;
> + VMA_ITERATOR(vmi, mm, 0);
>
> - for (vma = mm->mmap; vma; vma = vma->vm_next) {
> + for_each_vma(vmi, vma) {
> if (!vma->vm_file)
> continue;
>
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index 6357c3580d07..5dee6c41f36d 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -356,9 +356,10 @@ static bool valid_ref_ctr_vma(struct uprobe *uprobe,
> static struct vm_area_struct *
> find_ref_ctr_vma(struct uprobe *uprobe, struct mm_struct *mm)
> {
> + VMA_ITERATOR(vmi, mm, 0);
> struct vm_area_struct *tmp;
>
> - for (tmp = mm->mmap; tmp; tmp = tmp->vm_next)
> + for_each_vma(vmi, tmp)
> if (valid_ref_ctr_vma(uprobe, tmp))
> return tmp;
>
> @@ -1237,11 +1238,12 @@ int uprobe_apply(struct inode *inode, loff_t offset,
>
> static int unapply_uprobe(struct uprobe *uprobe, struct mm_struct *mm)
> {
> + VMA_ITERATOR(vmi, mm, 0);
> struct vm_area_struct *vma;
> int err = 0;
>
> mmap_read_lock(mm);
> - for (vma = mm->mmap; vma; vma = vma->vm_next) {
> + for_each_vma(vmi, vma) {
> unsigned long vaddr;
> loff_t offset;
>
> @@ -1989,9 +1991,10 @@ bool uprobe_deny_signal(void)
>
> static void mmf_recalc_uprobes(struct mm_struct *mm)
> {
> + VMA_ITERATOR(vmi, mm, 0);
> struct vm_area_struct *vma;
>
> - for (vma = mm->mmap; vma; vma = vma->vm_next) {
> + for_each_vma(vmi, vma) {
> if (!valid_vma(vma, false))
> continue;
> /*
Powered by blists - more mailing lists