linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: James Simmons <jsimmons@edgeglobal.com>
Cc: "Stephen C. Tweedie" <sct@redhat.com>, linux-mm@kvack.org
Subject: Re: mm->mmap_sem
Date: Sat, 25 Sep 1999 16:55:01 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.10.9909251639140.1083-100000@laser.random> (raw)
In-Reply-To: <Pine.LNX.4.10.9909242002500.16745-100000@imperial.edgeglobal.com>

On Fri, 24 Sep 1999, James Simmons wrote:

>Just out of curoisty how would one revoke all read-write to that page?

man mprotect (have a look to PROT_NONE)

>I know this would be expensive to do.

If you don't know how to do that how do you know it's expensive? ;)

But indeed you are right: it's a bit expensive as if the pages are just
allocated you'll have to change all their ptes.

>Also what does LockPage, TryLockPage(page), and UnlockPage(page) do
>exactly? I assume this also doesn't protect the memory contents either.

They have nothing to do with the ptes and vmas and with the userspaces
accesses synchronization.

They only deals with I/O of memory to disk (and with the recycling of
cache/buffer pages to disk: obviously if a page is locked because under
I/O, you can't free it).

>What I'm guessing at is it protects the page struct itself. If you are

It basically synchoronizes the I/O of whole pages from/to disk.

>changing the protections on a page you don't want a another process also
>attempting to do this. 

That is preserved using the mmap_sem as the mmap_sem serializes the
ptes/vmas writes. (mprotect grab the mmap sem of course)

>> then there is no page fault.  Otherwise you'd be doing massive amounts
>> of kernel work for every byte of data accessed by every process.
>
>Makes sense. I see its a clock algorithm that looks threw the pages and
>markes the pages as dirty that have been accessed. Thanks to the link

What Stephen wanted to tell is that if you have the pages just mapped and
allocated in the process space (pte_present(pte) == 1), then no page fault
will happen by touching such pages.

Only the _first_ time you'll touch a (not mlocked) anonymous mapping
(malloced region) you'll trigger a page-fault to effectively allocate and 
then map a zeroed page for the process.

Andrea

--
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/

  reply	other threads:[~1999-09-25 14:55 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   ` mm->mmap_sem James Simmons
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         ` Andrea Arcangeli [this message]
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.9909251639140.1083-100000@laser.random \
    --to=andrea@suse.de \
    --cc=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