From: James Simmons <jsimmons@edgeglobal.com>
To: "Stephen C. Tweedie" <sct@redhat.com>
Cc: linux-mm@kvack.org
Subject: Re: mm->mmap_sem
Date: Fri, 24 Sep 1999 10:59:31 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.10.9909241040460.12262-100000@imperial.edgeglobal.com> (raw)
In-Reply-To: <14314.49322.671097.451248@dukat.scot.redhat.com>
On Fri, 24 Sep 1999, Stephen C. Tweedie wrote:
> Hi,
>
> On Wed, 22 Sep 1999 17:02:07 -0400 (EDT), James Simmons <jsimmons@edgeglobal.com> said:
>
> > I noticed that mm_struct has a semaphore in it. How go is it protecting
> > the memory region? Say we have teh following case. I have a process
> > that mmaps a chunk of memory and this memory can be sharded with other
> > processes. What if the process does a mlock which does a
> > down(mm->mmap_sem). Now the process goes to sleep and another process
> > tries to modify the memory region.
>
> You have missed the point of the semaphore. mmap_sem only protects the
> vm list against being modified temporarily. For example, it makes sure
> that you don't unmap a VM region while doing a page fault on the same
> region.
> An mlock() system call will take the semaphore while it performs the
> locking operation and page faults all of the locked data into memory,
> but when the mlock call returns, the semaphore will have been released.
Does this mean while one process is in the act of mlocking a memory
region another process can actually change the contents of that memory?
> > Will this semaphore protect this region? In a SMP machine same
> > thing. What kind of protect does this semaphore provide? Does it
> > prevent other process from doing anything to the memory.
>
> No.
I obtained this idea from do_page_fault. This function is called from a
interrupt when a process actually tries to access memory correct? Even if
the page does or doesn't exist? I noticed the down(&mm->mmap_sem) in
this function. Does this mean if I had a piece of code somewhere in the
kernel that already did a down(&mm->mmap_sem) on that memory region that
when do_page_fault would be called that the process trying to access that
page would be put to sleep? Once the semaphore would be released that then
the process would be woken up and then access that memory. If this is not
the case then what would really happen? Thank you for your help by the way
to try and understand this stuff.
>
> --Stephen
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://humbolt.geo.uu.nl/Linux-MM/
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/
next prev parent reply other threads:[~1999-09-24 14:59 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-09-22 21:02 mm->mmap_sem James Simmons
1999-09-24 0:07 ` mm->mmap_sem Stephen C. Tweedie
1999-09-24 14:59 ` James Simmons [this message]
1999-09-24 18:09 ` mm->mmap_sem Stephen C. Tweedie
1999-09-25 1:24 ` mm->mmap_sem James Simmons
1999-09-25 14:55 ` mm->mmap_sem Andrea Arcangeli
1999-09-25 16:50 ` mm->mmap_sem James Simmons
1999-09-25 17:06 ` mm->mmap_sem Andrea Arcangeli
1999-09-26 1:19 ` mm->mmap_sem James Simmons
1999-09-26 14:07 ` mm->mmap_sem Andrea Arcangeli
1999-09-27 8:55 ` mm->mmap_sem Marcus Sundberg
1999-09-27 19:31 ` mm->mmap_sem James Simmons
1999-09-29 23:00 ` mm->mmap_sem Stephen C. Tweedie
1999-09-30 0:17 ` mm->mmap_sem James Simmons
1999-09-30 0:23 ` mm->mmap_sem Benjamin C.R. LaHaise
1999-09-30 14:59 ` mm->mmap_sem James Simmons
1999-09-30 15:15 ` mm->mmap_sem Benjamin C.R. LaHaise
1999-09-30 16:05 ` mm->mmap_sem James Simmons
1999-09-30 14:54 ` mm->mmap_sem Stephen C. Tweedie
1999-09-27 14:16 ` mm->mmap_sem Stephen C. Tweedie
1999-09-27 20:22 ` mm->mmap_sem James Simmons
1999-09-27 14:13 ` mm->mmap_sem Stephen C. Tweedie
1999-09-27 8:08 ` mm->mmap_sem Neil Conway
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.10.9909241040460.12262-100000@imperial.edgeglobal.com \
--to=jsimmons@edgeglobal.com \
--cc=linux-mm@kvack.org \
--cc=sct@redhat.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