[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <57e33b08-f578-b84d-664b-939d9100d54d@suse.cz>
Date: Wed, 19 Jan 2022 18:04:46 +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 49/66] bpf: Remove VMA linked list
On 12/1/21 15:30, Liam Howlett wrote:
> From: "Liam R. Howlett" <Liam.Howlett@...cle.com>
>
> Use vma_next() and remove reference to the start of the linked list
>
> Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
> ---
> kernel/bpf/task_iter.c | 21 ++++-----------------
> 1 file changed, 4 insertions(+), 17 deletions(-)
>
> diff --git a/kernel/bpf/task_iter.c b/kernel/bpf/task_iter.c
> index b48750bfba5a..2d964743f1e6 100644
> --- a/kernel/bpf/task_iter.c
> +++ b/kernel/bpf/task_iter.c
> @@ -299,8 +299,8 @@ struct bpf_iter_seq_task_vma_info {
> };
>
> enum bpf_task_vma_iter_find_op {
> - task_vma_iter_first_vma, /* use mm->mmap */
> - task_vma_iter_next_vma, /* use curr_vma->vm_next */
> + task_vma_iter_first_vma, /* use find_vma() with addr 0 */
> + task_vma_iter_next_vma, /* use vma_next() with curr_vma */
> task_vma_iter_find_vma, /* use find_vma() to find next vma */
> };
>
> @@ -400,24 +400,11 @@ task_vma_seq_get_next(struct bpf_iter_seq_task_vma_info *info)
>
> switch (op) {
> case task_vma_iter_first_vma:
> - curr_vma = curr_task->mm->mmap;
> + curr_vma = find_vma(curr_task->mm, 0);
> break;
> case task_vma_iter_next_vma:
> - curr_vma = curr_vma->vm_next;
> - break;
> case task_vma_iter_find_vma:
> - /* We dropped mmap_lock so it is necessary to use find_vma
> - * to find the next vma. This is similar to the mechanism
> - * in show_smaps_rollup().
> - */
> - curr_vma = find_vma(curr_task->mm, info->prev_vm_end - 1);
> - /* case 1) and 4.2) above just use curr_vma */
> -
> - /* check for case 2) or case 4.1) above */
> - if (curr_vma &&
> - curr_vma->vm_start == info->prev_vm_start &&
> - curr_vma->vm_end == info->prev_vm_end)
> - curr_vma = curr_vma->vm_next;
> + curr_vma = find_vma(curr_task->mm, curr_vma->vm_end);
Are you sure curr_vma is valid here and we can read its vm_end? Because I
have no idea, but lots of doubts.
> break;
> }
> if (!curr_vma) {
Powered by blists - more mailing lists