Re: [PATCH 2/4] mm/mmap/vma_merge: set next to NULL if not applicable

From: Vernon Yang
Date: Mon Mar 20 2023 - 10:25:48 EST


On Sat, Mar 18, 2023 at 11:13:19AM +0000, Lorenzo Stoakes wrote:
> We are only interested in next if end == next->vm_start (in which case we
> check to see if we can set merge_next), so perform this check alongside
> checking whether curr should be set.
>
> This groups all of the simple range checks together and establishes the
> invariant that, if prev, curr or next are non-NULL then their positions are
> as expected.
>
> Additionally, use the abstract 'vma' object to look up the possible curr or
> next VMA in order to avoid any confusion as to what these variables
> represent - now curr and next are assigned once and only once.

Hi Lorenzo,

Due to the "vma" variable is used as an intermediate member, I feels a bit
confusing, so cleanup this patch as below.

If this cleanup patch is issue, please let me know, and then ignore it
directly, thanks.

----