diff options
| author | Wei Yang <[email protected]> | 2024-10-24 09:33:47 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2024-11-07 04:11:20 +0000 |
| commit | 642c66d84cd4c0506698ae52d0c6fd12d3695c01 (patch) | |
| tree | 7b28a831af48e30910c3ba1c6079916fa413275c /arch/powerpc/lib/code-patching.c | |
| parent | mm: defer second attempt at merge on mmap() (diff) | |
| download | kernel-642c66d84cd4c0506698ae52d0c6fd12d3695c01.tar.gz kernel-642c66d84cd4c0506698ae52d0c6fd12d3695c01.zip | |
mm/vma: the pgoff is correct if can_merge_right
By this point can_vma_merge_right() must have returned true, which implies
can_vma_merge_before() also returned true, which already asserts that the
pgoff is as expected for a merge with the following VMA, thus this
assignment is redundant.
Below is a more detail explanation.
Current definition of can_vma_merge_right() is:
static bool can_vma_merge_right(struct vma_merge_struct *vmg,
bool can_merge_left)
{
if (!vmg->next || vmg->end != vmg->next->vm_start ||
!can_vma_merge_before(vmg))
return false;
...
}
And:
static bool can_vma_merge_before(struct vma_merge_struct *vmg)
{
pgoff_t pglen = PHYS_PFN(vmg->end - vmg->start);
...
if (vmg->next->vm_pgoff == vmg->pgoff + pglen)
return true;
...
}
Which implies vmg->pgoff == vmg->next->vm_pgoff - pglen.
None of these values are changed between the check and prior assignment,
so this was an entirely redundant assignment.
[[email protected]: remove now-unused local]
[[email protected]: rephrase the changelog]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Wei Yang <[email protected]>
Reviewed-by: Lorenzo Stoakes <[email protected]>
Cc: Jann Horn <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Liam R. Howlett <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'arch/powerpc/lib/code-patching.c')
0 files changed, 0 insertions, 0 deletions
