kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* [virtual memory] page_table_lock & mmap_sem
@ 2011-03-29 22:30 Venkatram Tummala
  2011-03-30  3:58 ` sk.syed2
  2011-03-31 15:14 ` Rik van Riel
  0 siblings, 2 replies; 3+ messages in thread
From: Venkatram Tummala @ 2011-03-29 22:30 UTC (permalink / raw)
  To: kernelnewbies

Hi,

Why do we need both page_table_lock & mmap_sem in the kernel. Why isn't
mmap_sem good enough for serialization. As far as i see it, all attempts to
change the page table hierarchy in the kernel is done after holding the
write lock on mmap_sem. As we are already holding the write lock, we do we
need an extra page_table_lock (spinlock) ? Are there any code paths in the
kernel which attempt to modify the page table hierarchy without holding the
write lock on mmap_sem ?

page_table_lock is a finer grained lock than mmap_sem but page_table_lock is
only taken after holding a write lock on mmap_sem (as far as i can tell).

What is the reasoning behind having an extra spinlock?

Thanks.

Venkatram Tummala
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110329/28620d70/attachment.html 

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

* [virtual memory] page_table_lock & mmap_sem
  2011-03-29 22:30 [virtual memory] page_table_lock & mmap_sem Venkatram Tummala
@ 2011-03-30  3:58 ` sk.syed2
  2011-03-31 15:14 ` Rik van Riel
  1 sibling, 0 replies; 3+ messages in thread
From: sk.syed2 @ 2011-03-30  3:58 UTC (permalink / raw)
  To: kernelnewbies

On Tue, Mar 29, 2011 at 5:30 PM, Venkatram Tummala
<venkatram867@gmail.com> wrote:
> Hi,
> Why do we need both page_table_lock & mmap_sem in the kernel. Why isn't
See linux/Documentation/vm/locking

-syed

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

* [virtual memory] page_table_lock & mmap_sem
  2011-03-29 22:30 [virtual memory] page_table_lock & mmap_sem Venkatram Tummala
  2011-03-30  3:58 ` sk.syed2
@ 2011-03-31 15:14 ` Rik van Riel
  1 sibling, 0 replies; 3+ messages in thread
From: Rik van Riel @ 2011-03-31 15:14 UTC (permalink / raw)
  To: kernelnewbies

On 03/29/2011 06:30 PM, Venkatram Tummala wrote:
> Hi,
>
> Why do we need both page_table_lock & mmap_sem in the kernel. Why isn't
> mmap_sem good enough for serialization. As far as i see it, all attempts
> to change the page table hierarchy in the kernel is done after holding
> the write lock on mmap_sem. As we are already holding the write lock, we
> do we need an extra page_table_lock (spinlock) ? Are there any code
> paths in the kernel which attempt to modify the page table hierarchy
> without holding the write lock on mmap_sem ?

Yes, there are.

Look at the page fault code, which takes a read lock
on mmap_sem.

This allows multiple threads in a multi-threaded process
to handle page faults simultaneously.

-- 
All rights reversed.

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

end of thread, other threads:[~2011-03-31 15:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-29 22:30 [virtual memory] page_table_lock & mmap_sem Venkatram Tummala
2011-03-30  3:58 ` sk.syed2
2011-03-31 15:14 ` Rik van Riel

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).