On Wed, Jun 16, 2004 at 08:52:18AM +0300, Micha Feigin wrote:

> There was just a thread about this in kernel newbies, but I don't
> remember the exact details. IIRC the kernel address the first 896M of
> memory directly, not as virtual memory 

No, the kernel maps the first 896M into its virtual address space, and
the virtual address space of every process. 

> User space get real virtual addresses, i.e a pointer in
> userspace can point into the swap. 

This is inaccurate. Userspace pointers are just virtual pointers. When
userspace would derference them, the CPU will raise a page fault if
the backing physical page is not available (based on the contents of
the page table entry (PTE) mapping this page). The page fault handler
in the kernel would then recognize whether the page needs to be
brought in from swap or allocated in the first time (or broken from
COW), do whatever is required, update the PTE, and restart the
faulting address. 

> There is no direct corelation
> between user space pointers and physical addresses.

user space always(*) uses virtual addresses. 

(*) userspace drivers with kernel components that map physical pages
for them excluded. 

> I am not sure though how the swap fits into the whole memory
> scheme. Will be happy for some clarification there. Is it possible to
> have 500M ram + 3 GB swap with no himem? 

Yes. 

> (Ignoring the overhead of 3G
> swap and other large swap related issues for the moment). I assume yes,
> but like I said, where does it fit into the virtual memory issue.

The kernel will use the 500M of physical memory. If at any time the
machine uses more than 500M of physical memory, the least recently
used pages will be swapped out and then brought in again when
required. 

Cheers, 
Muli 
-- 
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/

Attachment: signature.asc
Description: Digital signature

Reply via email to