kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: riel@surriel.com (Rik van Riel)
To: kernelnewbies@lists.kernelnewbies.org
Subject: [virtual memory] page_table_lock & mmap_sem
Date: Thu, 31 Mar 2011 11:14:50 -0400	[thread overview]
Message-ID: <4D949A6A.5040803@surriel.com> (raw)
In-Reply-To: <AANLkTimnyMAqrHpnx_7vBmcLruDYpGDw2axf-iQo6g8G@mail.gmail.com>

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.

      parent reply	other threads:[~2011-03-31 15:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=4D949A6A.5040803@surriel.com \
    --to=riel@surriel.com \
    --cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).