linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re : vm: weird behaviour when munmapping
@ 2006-11-17 13:43 moreau francis
  2006-11-17 13:48 ` Peter Zijlstra
  0 siblings, 1 reply; 12+ messages in thread
From: moreau francis @ 2006-11-17 13:43 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: linux-kernel

Peter Zijlstra wrote:
> On Fri, 2006-11-17 at 12:50 +0000, moreau francis wrote:
>>
>> lower vma: 0x2aaae000 -> 0x2aaaf000
>> upper vma: 0x2aaaf000 -> 0x2aab2000
> 
> that is the remaining VMA, not the new one; we trigger this code:
> 
>     /* Does it split the last one? */
>     last = find_vma(mm, end);
>     if (last && end > last->vm_start) {
>         int error = split_vma(mm, last, end, 1);
>         if (error)
>             return error;
>     }
> 
> So, since its the last VMA that needs to be split (there is only one),
> the new VMA is constructed before the old one. Like so:
> 
>   AAAAAAAAAAAAAAAAAAAAA
>   BBBBAAAAAAAAAAAAAAAAA
> 
> Then you proceed closing, in this case the new one: B.

Sorry but I don't understand why B is said to be the new one. OK
I can see why from the bit of code you pointed out but from a
logical point of view (ok maybe be me only) I'm unmapping 'BBBB'
segment, so 'BBBB' is going to be destroyed and therefore A is
the new one. Thereferore I would expect close(B), open(A)...

no ?

Francis






	

	
		
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses 
http://fr.answers.yahoo.com

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re : vm: weird behaviour when munmapping
@ 2006-11-17 21:01 Francis Moreau
  2006-11-18 13:55 ` Hugh Dickins
  0 siblings, 1 reply; 12+ messages in thread
From: Francis Moreau @ 2006-11-17 21:01 UTC (permalink / raw)
  To: a.p.zijlstra; +Cc: linux-kernel

[me moving to Gmail 'cause yahoo sucks !]

On Fri, 2006-11-17 at 14:12 +0000, moreau francis wrote:
> Peter Zijlstra wrote:
>
> The new object is the one allocated using:
>	new = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
>

Of course but at this point the choice of the new VMA is already made
by the caller. So in our case do_munmap() decided that B is the new
one as you said. But I still don't see why...

And as I said previously it will end up by calling consecutively:

        vma->vm_ops->open(B)
        vma->vm_ops->close(B)


> Please read Mel Gorman's book on memory management to gain a better
> understanding.
>
> http://www.phptr.com/bookstore/product.asp?isbn=0131453483&rl=1

thanks for the link, but I don't expect to find out the answer to this
very specific question in it.

Francis

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re : vm: weird behaviour when munmapping
@ 2006-11-17 14:12 moreau francis
  2006-11-17 14:21 ` Peter Zijlstra
  0 siblings, 1 reply; 12+ messages in thread
From: moreau francis @ 2006-11-17 14:12 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: linux-kernel

Peter Zijlstra wrote:
> No indeed. You seem confused with remaining and new. 
> 
> It has one VMA (A) it needs to split that into two pieces, it happens to
> do it like (B,A') where A' is the old VMA object with new a start
> address, and B is a new VMA object.

Is there any rules to decide which VMA is the new one ? 

>From what you wrote it seems that we call B the new object because
it has a new end address...

>From my point of view, I called B the old VMA simply because it's
going to be destroyed...

Francis





	

	
		
___________________________________________________________________________ 
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re : vm: weird behaviour when munmapping
@ 2006-11-17 12:50 moreau francis
  2006-11-17 13:05 ` Peter Zijlstra
  0 siblings, 1 reply; 12+ messages in thread
From: moreau francis @ 2006-11-17 12:50 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: linux-kernel

Peter Zijlstra wrote:
> 
> http://lwn.net/Kernel/LDD3/
> 
> Chapter 15. Section 'Virtual Memory Areas'.
> 
> Basically; vm_ops->open() is not called on the first vma. With this
> munmap() you split the area in two, and it so happens the new vma is the
> lower one.
> 

since I did "munmap(0x2aaae000, 1024)" I would say that the the new vma
is the _upper_ one.

lower vma: 0x2aaae000 -> 0x2aaaf000
upper vma: 0x2aaaf000 -> 0x2aab2000

Francis







	

	
		
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses 
http://fr.answers.yahoo.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2006-11-21  8:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-17 13:43 Re : vm: weird behaviour when munmapping moreau francis
2006-11-17 13:48 ` Peter Zijlstra
  -- strict thread matches above, loose matches on Subject: below --
2006-11-17 21:01 Francis Moreau
2006-11-18 13:55 ` Hugh Dickins
2006-11-20 11:30   ` Francis Moreau
2006-11-20 11:36     ` Hugh Dickins
2006-11-20 12:20     ` Hugh Dickins
2006-11-21  8:41       ` Francis Moreau
2006-11-17 14:12 moreau francis
2006-11-17 14:21 ` Peter Zijlstra
2006-11-17 12:50 moreau francis
2006-11-17 13:05 ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).