From: Anshuman Khandual <khandual@linux.vnet.ibm.com>
To: Michal Hocko <mhocko@kernel.org>,
Anshuman Khandual <khandual@linux.vnet.ibm.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, mike.kravetz@oracle.com
Subject: Re: [RFC] mm/mremap: Remove redundant checks inside vma_expandable()
Date: Tue, 11 Jul 2017 09:58:42 +0530 [thread overview]
Message-ID: <d6f9ec12-4518-8f97-eca9-6592808b839d@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170710134917.GB19645@dhcp22.suse.cz>
On 07/10/2017 07:19 PM, Michal Hocko wrote:
> On Mon 10-07-17 16:40:59, Anshuman Khandual wrote:
>> As 'delta' is an unsigned long, 'end' (vma->vm_end + delta) cannot
>> be less than 'vma->vm_end'.
>
> This just doesn't make any sense. This is exactly what the overflow
> check is for. Maybe vm_end + delta can never overflow because of
> (old_len == vma->vm_end - addr) and guarantee old_len < new_len
> in mremap but I haven't checked that too deeply.
Irrespective of that, just looking at the variables inside this
particular function where delta is an 'unsigned long', 'end' cannot
be less than vma->vm_end. Is not that true ?
>
>> Checking for availability of virtual
>> address range at the end of the VMA for the incremental size is
>> also reduntant at this point. Hence drop them both.
>
> OK, this seems to be the case due the above (comment says "old_len
> exactly to the end of the area..").
yeah but is the check necessary ?
>
> But I am wondering what led you to the patch because you do not say so
As can be seen in the test program, was trying to measure the speed
of VMA expansion and contraction inside an address space and then
figured out that dropping this check improves the speed prima facie.
> here. This is hardly something that would save many cycles in a
> relatively cold path.
Though I have not done any detailed instruction level measurement,
there is a reduction in real and system amount of time to execute
the test with and without the patch.
Without the patch
real 0m2.100s
user 0m0.162s
sys 0m1.937s
With this patch
real 0m0.928s
user 0m0.161s
sys 0m0.756s
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-07-11 4:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-10 11:10 Anshuman Khandual
2017-07-10 13:49 ` Michal Hocko
2017-07-11 4:28 ` Anshuman Khandual [this message]
2017-07-11 6:03 ` Michal Hocko
2017-07-11 6:26 ` Vlastimil Babka
2017-07-11 6:50 ` Michal Hocko
2017-07-11 6:56 ` Vlastimil Babka
2017-07-11 7:16 ` Michal Hocko
2017-07-11 7:22 ` Michal Hocko
2017-07-11 11:19 ` Anshuman Khandual
2017-07-11 11:11 ` Anshuman Khandual
2017-07-11 11:08 ` Anshuman Khandual
2017-07-11 11:22 ` Michal Hocko
2017-07-19 6:49 ` Anshuman Khandual
2017-07-11 11:06 ` Anshuman Khandual
2017-07-11 9:44 ` Anshuman Khandual
2017-07-11 4:29 ` Anshuman Khandual
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=d6f9ec12-4518-8f97-eca9-6592808b839d@linux.vnet.ibm.com \
--to=khandual@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mike.kravetz@oracle.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