From: Hugh Dickins <hugh@veritas.com>
To: Paul Jackson <pj@sgi.com>
Cc: Andi Kleen <ak@suse.de>,
akpm@osdl.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: Does shmem_getpage==>shmem_alloc_page==>alloc_page_vma hold mmap_sem?
Date: Sun, 6 Nov 2005 05:56:42 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.61.0511060547120.14675@goblin.wat.veritas.com> (raw)
In-Reply-To: <20051105212133.714da0d2.pj@sgi.com>
On Sat, 5 Nov 2005, Paul Jackson wrote:
>
> The comment in mm/mempolicy.c for alloc_page_vma() states:
>
> Should be called with the mm_sem of the vma hold.
>
> However it seems that the call chain (#ifdef CONFIG_NUMA):
>
> shmem_getpage ==> shmem_alloc_page ==> alloc_page_vma
>
> where shmem_getpage() is called from many of the mm/shmem.c file
> operations, is called without holding mmap_sem. There is no
> mention of mmap_sem in the entire mm/shmem.c file.
It's safe but horrid. Look closer and you'll find there isn't even
an mm to hold the mmap_sem of. The struct vm_area_struct is on the
stack of shmem_alloc_page, and exists solely to apply mempolicy to
a shmem file via an interface designed for mempolicy on vmas.
So far as I know, it works fine; but that interface really ought
to be redesigned some time - it looks like a quick hack that stuck.
Hugh
--
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:[~2005-11-06 5:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-06 5:21 Paul Jackson
2005-11-06 5:56 ` Hugh Dickins [this message]
2005-11-06 6:17 ` Paul Jackson
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.61.0511060547120.14675@goblin.wat.veritas.com \
--to=hugh@veritas.com \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pj@sgi.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