From: Matthew Wilcox <willy@infradead.org>
To: Wei Yang <richard.weiyang@gmail.com>
Cc: akpm@linux-foundation.org, mhocko@suse.com, linux-mm@kvack.org
Subject: Re: [PATCH] mm: remove a redundant check in do_munmap()
Date: Wed, 10 Oct 2018 07:13:55 -0700 [thread overview]
Message-ID: <20181010141355.GA22625@bombadil.infradead.org> (raw)
In-Reply-To: <20181010125327.68803-1-richard.weiyang@gmail.com>
On Wed, Oct 10, 2018 at 08:53:27PM +0800, Wei Yang wrote:
> A non-NULL vma returned from find_vma() implies:
>
> vma->vm_start <= start
>
> Since len != 0, the following condition always hods:
>
> vma->vm_start < start + len = end
>
> This means the if check would never be true.
This is true because earlier in the function, start + len is checked to
be sure that it does not wrap.
> This patch removes this redundant check and fix two typo in comment.
> @@ -2705,12 +2705,8 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len,
> - /* we have start < vma->vm_end */
> -
> - /* if it doesn't overlap, we have nothing.. */
> + /* we have vma->vm_start <= start < vma->vm_end */
> end = start + len;
> - if (vma->vm_start >= end)
> - return 0;
I agree that it's not currently a useful check, but it's also not going
to have much effect on anything to delete it. I think there are probably
more worthwhile places to look for inefficiencies.
next prev parent reply other threads:[~2018-10-10 14:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-10 12:53 [PATCH] mm: remove a redundant check in do_munmap() Wei Yang
2018-10-10 14:13 ` Kirill A. Shutemov
2018-10-10 15:19 ` Wei Yang
2018-10-10 14:13 ` Matthew Wilcox [this message]
2018-10-10 15:23 ` Wei Yang
2018-10-16 6:24 ` Wei Yang
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=20181010141355.GA22625@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=richard.weiyang@gmail.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;
as well as URLs for NNTP newsgroup(s).