[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Doubt regarding memory
On Thursday 01 March 2007 07:10, Mulyadi Santosa wrote:
> Hello Tzahi
>
> You really give me tough Q :)
:), hopefully we are both learning :).
> 6. Before page are returned to user space, the related page tables that
> points to these pages are manipulated so that they are using user space
> virtual address space range (the clue is by looking where the fault did
> happen)
>
> Note those pages now could have two mapping (if they lies inside normal
> and DMA zone), one is via identity mapping, one is that process's own
> mapping
Does that mean that kernel memory is swappable/context switched. I.e. when the
process is "current", he can address the same physical address the kernel
will when the process is still in the run queue but not "current".
>
> > Let's say we have 2gb ram.
> > If the kernel already allocated it's 3-4gb (1gb) but it wants more, it
> > will have to resort to taking from virtual user space addresses, right?
> > but they won't be protected so what gives?
>
> If the kernel wants more, it can do so via temporary mapping (kmap()).
> By doing it, the highmem pages will be temporarily mapped in the area
> slightly beyond the end of kernel identity mapping (AFAIK, this is the
> one we know as the upper 128 MB area, use for vmalloc, fixed linear
I think vmalloc also takes first from the normal zone (since it actually uses
kmalloc IIRC).
Also, i am trying to understand this identity mapping. I understand it's
simplicity, but how the MMU uses this fact? is it still uses page tables for
this? since this would be very wasteful.
In addition, i understand that in (no pae) x86 32bit you have 1MB of 4 bytes
entries that can be referenced by the MMU (which, i think, can only address
1gb of ram pages). Does this mean that the kernel has to change the page
tables as necessary, i.e. when a process does context switch and needs the
same virtual page address used by a different process. Does the kernel leaves
there (in the MMU current page tables) some entries of its own constantly?
> I wish my explanation really clears the confusion, because once I
> struggled a lot with these things too and slowly I got the idea.
Yes 10x, this things are complicated.
--
Regards,
Tzahi.
--
Tzahi Fadida
Blog: http://tzahi.blogsite.org | Home Site: http://tzahi.webhop.info
WARNING TO SPAMMERS: see at
http://members.lycos.co.uk/my2nis/spamwarning.html
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ