lkml.org 
[lkml]   [1998]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: How to read-protect a vm_area?
Linus Torvalds wrote:
>
> Essentially, the problem is that currently I use the "present" bit to
> imply that the page is in RAM vs paged out. This is the obvious and
> straightforward implementation - it's what the hardware does. But I
> _could_ use two bits for that, where the pattern would be:
>
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx00 - truly not present (ie paged out)
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx10 - PROT_NONE
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1 - present
>
> which should work fairly well, and would still match the hardware
> behaviour we want.
>

I do not know if any modern hardware has a similar "feature", on some
systems it is really necessary to have two "present" bits, one
interpreted
by the MMU hardware and the other interpreted by the OS.

The VAX architecture did not have an "accessed" bit on the page table
entry (it did have a "dirty" bit).
The OS had to simulate the missing "accessed" bit.
When free memory became low the pager started to mark pages as "not
present"
for the hardware (but not swap them out yet), and put these pages on the
free page list. A separate bit tells the software that the page is still
there. If such page is accessed, it causes a page fault trap. The trap
handler
Just needs to turn on the "present" and the simulated "accessed" bits,
(some list manipulation was also involved). these events are counted as
"reclaims" by vmstat.
If a free page is really needed one of the older pages on the free list
can be used.
Forgive me if I do not remember the details very well... Last time that
I had a good study of that code (BSD 4.1) it was more than 15 years ago.

Itai
--
Itai Nahshon nahshon@actcom.co.il
Also nahshon@vnet.ibm.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 13:41    [W:0.057 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site