Re: [PATCH] mm: remove a redundant check in do_munmap()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 10, 2018 at 07:13:55AM -0700, Matthew Wilcox wrote:
>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.

Thanks for your comment.

Agree, this will not have impact on performance.

The intentinon here is to make the code more clear, otherwise this is a
little misleading. Especially for the comment just before this *if*
clause, audience may think it is possible to have a non-overlap region.

-- 
Wei Yang
Help you, Help me




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux