Re: [PATCH] fix madvise vma merging

From: Prasanna Meda
Date: Mon Aug 08 2005 - 14:47:31 EST


Hugh Dickins wrote:

> On Fri, 5 Aug 2005, Prasanna Meda wrote:
> > Hugh Dickins wrote:
> >
> > > 2. Correct initial value of prev when starting part way into a vma: as
> > > in sys_mprotect and do_mlock, it needs to be set to vma in this case
> > > (vma_merge handles only that minimum of cases shown in its comments).
> >
> > Acknowledge corrections 1 and 3 readily. Treated vma_merge
> > as block box that can handle all cases. Motivation for pointless
> > case 3 is to skip holes and did not notice that has been covered.
> > Thanks for corrections.
>
> And thanks for the confirmations.
>
> > Correction 2 is tricky. Sometimes it merges similar to case 3,
> > misses a needed split, where after the fix we can get case 4
> > merge. If that is what you are saying, we are in agreement.
> > Otherwise, can you explain the real problem?
>
> I probably am saying what you are saying there,
> but it's hard for me to understand it that way.
>
> Missing out the "start > vma->vm_start" adjustment of prev introduces
> additional (but redundant: non-canonical) cases not considered at all
> by vma_merge, now entered with a "prev" which is remote and surely
> irrelevant to merging. "misses a needed split", yes, I saw that;
> indeed my test ended up taking the "cases 3, 8" path, when, given
> the right prev, it should have been handled as a "case 4".
>

Ok, we both are on the same page. Your obseravtions are same.
Thanks a lot for the code review and finding corner cases.

-Prasanna.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/