lkml.org 
[lkml]   [2019]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] perf map: fix overlapped map handling
Date
>>  			after->start = map->end;
>> + after->pgoff = pos->map_ip(pos, map->end);
>
> So is this equivalent to what __split_vma() does in the kernel, i.e.:
>
> if (new_below)
> new->vm_end = addr;
> else {
> new->vm_start = addr;
> new->vm_pgoff += ((addr - vma->vm_start) >> PAGE_SHIFT);
> }
>
> where new->vm_pgoff starts equal to the vm_pgoff of the mmap being split?

It is roughly equivalent. The pgoff in struct map is stored in bytes not in pages, so it doesn't include the shift.

An earlier version of this patch used:
after->start = map->end;
+ after->pgoff += map->end - pos->start;

Instead of the newer Functionally equivalent:
after->start = map->end;
+ after->pgoff = pos->map_ip(pos, map->end);

I preferred the latter form as it made more sense with the assertion that the mapping of map->end should match in pos and after.

Steve

\
 
 \ /
  Last update: 2019-09-20 23:46    [W:0.065 / U:24.972 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site