From: Hugh Dickins <hugh@veritas.com>
To: Francis Moreau <francis.moro@gmail.com>
Cc: a.p.zijlstra@chello.nl, linux-kernel@vger.kernel.org
Subject: Re: Re : vm: weird behaviour when munmapping
Date: Sat, 18 Nov 2006 13:55:54 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.64.0611181340220.7193@blonde.wat.veritas.com> (raw)
In-Reply-To: <38b2ab8a0611171301pe16229ch441ec24c538b1998@mail.gmail.com>
On Fri, 17 Nov 2006, Francis Moreau wrote:
> 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...
split_vma decides which address range will use the newly allocated
vm_area_struct in such a way as to suit its own convenience, and
that of mremap's move_vma. "new" is the name of a variable in
split_vma, you should stop agonizing over it.
>
> And as I said previously it will end up by calling consecutively:
>
> vma->vm_ops->open(B)
> vma->vm_ops->close(B)
You are attaching too much significance to the current address
of the vma which is passed to your driver in open and close.
As mmap.c splits and merges vmas, in response to system calls
unmapping and mapping, those addresses will change.
The important thing is the info contained within the vma: perhaps
your underlying complaint is that your driver is not getting as
much info as it wants about what's happening?
I think (haven't searched) most drivers, if they care at all,
only care about the total number of their vmas: can free
resources when that count goes down to 0.
Hugh
next prev parent reply other threads:[~2006-11-18 13:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-17 21:01 Francis Moreau
2006-11-18 13:55 ` Hugh Dickins [this message]
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
-- strict thread matches above, loose matches on Subject: below --
2006-11-17 14:12 moreau francis
2006-11-17 14:21 ` Peter Zijlstra
2006-11-17 13:43 moreau francis
2006-11-17 13:48 ` Peter Zijlstra
2006-11-17 12:50 moreau francis
2006-11-17 13:05 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0611181340220.7193@blonde.wat.veritas.com \
--to=hugh@veritas.com \
--cc=a.p.zijlstra@chello.nl \
--cc=francis.moro@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®