From: Konstantin Khlebnikov <koct9i@gmail.com>
To: Wang YanQing <udknight@gmail.com>
Cc: Mel Gorman <mgorman@suse.de>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
yinghai@kernel.org.ahead-top.com,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [RFC] Strange do_munmap in mmap_region
Date: Thu, 19 Mar 2015 11:33:41 +0300 [thread overview]
Message-ID: <CALYGNiMLwhqQSmj58mT4MWk2RAuU-3TykoSd=XjuXVfqkL3NoA@mail.gmail.com> (raw)
In-Reply-To: <20150228064647.GA9550@udknight.ahead-top.com>
On Sat, Feb 28, 2015 at 9:46 AM, Wang YanQing <udknight@gmail.com> wrote:
> Hi Mel Gorman and all.
>
> I have read do_mmap_pgoff and mmap_region more than one hour,
> but still can't catch sense about below code in mmap_region:
>
> "
> /* Clear old maps */
> error = -ENOMEM;
> munmap_back:
> if (find_vma_links(mm, addr, addr + len, &prev, &rb_link, &rb_parent)) {
> if (do_munmap(mm, addr, len))
> return -ENOMEM;
> goto munmap_back;
> }
> "
>
> How can we just do_munmap overlapping vma without check its vm_flags
> and new vma's vm_flags? I must miss some important things, but I can't
> figure out.
>
> You give below comment about the code in "understand the linux memory manager":)
>
> "
> If a VMA was found and it is part of the new mmapping, this removes the
> old mmapping because the new one will cover both
> "
>
> But if new mmapping has different vm_flags or others' property, how
> can we just say the new one will cover both?
>
> I appreicate any clue and explanation about this headache question.
>
> Thanks.
>
Mmap() creates new mapping in given range
(new vma might be merged to one or both of sides if possible)
so everything what was here before is unmapped in process. Not?
>
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-03-19 8:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-28 6:46 [RFC] Strange do_munmap in mmap_region Wang YanQing
2015-03-19 8:33 ` Konstantin Khlebnikov [this message]
2015-03-19 15:12 ` Wang YanQing
2015-03-19 15:36 ` Konstantin Khlebnikov
2015-03-20 15:41 ` Wang YanQing
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='CALYGNiMLwhqQSmj58mT4MWk2RAuU-3TykoSd=XjuXVfqkL3NoA@mail.gmail.com' \
--to=koct9i@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=udknight@gmail.com \
--cc=yinghai@kernel.org.ahead-top.com \
/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;
as well as URLs for NNTP newsgroup(s).