From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
To: Peng Zhang <zhangpeng362@huawei.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, wangkefeng.wang@huawei.com,
sunnanyong@huawei.com
Subject: Re: [PATCH] mm/madvise: Use vma_lookup() instead of find_vma()
Date: Wed, 5 Apr 2023 13:19:12 -0400 [thread overview]
Message-ID: <20230405171912.6o7tiy6qzg5wfyi7@revolver> (raw)
In-Reply-To: <20230404094515.1883552-1-zhangpeng362@huawei.com>
* Peng Zhang <zhangpeng362@huawei.com> [230404 05:45]:
> From: ZhangPeng <zhangpeng362@huawei.com>
>
> Using vma_lookup() verifies the address is contained in the found vma.
> This results in easier to read the code.
>
> Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
> ---
> mm/madvise.c | 14 +-------------
> 1 file changed, 1 insertion(+), 13 deletions(-)
>
> diff --git a/mm/madvise.c b/mm/madvise.c
> index 340125d08c03..405a2c4a0a18 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
> @@ -852,21 +852,9 @@ static long madvise_dontneed_free(struct vm_area_struct *vma,
> *prev = NULL; /* mmap_lock has been dropped, prev is stale */
>
> mmap_read_lock(mm);
> - vma = find_vma(mm, start);
> + vma = vma_lookup(mm, start);
> if (!vma)
> return -ENOMEM;
> - if (start < vma->vm_start) {
> - /*
> - * This "vma" under revalidation is the one
> - * with the lowest vma->vm_start where start
> - * is also < vma->vm_end. If start <
> - * vma->vm_start it means an hole materialized
> - * in the user address space within the
> - * virtual range passed to MADV_DONTNEED
> - * or MADV_FREE.
> - */
> - return -ENOMEM;
> - }
> /*
> * Potential end adjustment for hugetlb vma is OK as
> * the check below keeps end within vma.
> --
> 2.25.1
>
>
next prev parent reply other threads:[~2023-04-05 17:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 9:45 Peng Zhang
2023-04-05 17:19 ` Liam R. Howlett [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-03-11 8:27 Miaohe Lin
2022-03-11 9:55 ` David Hildenbrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230405171912.6o7tiy6qzg5wfyi7@revolver \
--to=liam.howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sunnanyong@huawei.com \
--cc=wangkefeng.wang@huawei.com \
--cc=zhangpeng362@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox