Re: Totally confused about kmap, highmem, and VM in general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > If so, why does the kernel need these areas of memory mapped into its
> > virtual address space? It seems like the kernel could keep a list of
> > all page frames that are available and then use this to map in page
> > frames for userspace memory without ever having it mapped into kernel
> > memory space.
>
> Besides the "kernel's own data structures" argument, there are
> security reasons why the kernel has to clear out a page's data
> before mapping the page into user space.
>
> This is more efficiently done if the page is already mapped into
> kernel address space, and does not have to be mapped in especially
> for the purpose.
>
> The kernel will leave the memory mapped into kernel address space
> after it has been given to a user process.  This makes it easier
> to process the page in the future, eg. after the process has stopped
> using the page.
>
> > Then, lets say we have a machine with 1.5GB of memory.  The kernel
> > linearly maps 896MB of space into kernel space and the leaves teh
> > remaning 128MB for temporary mappings.  When are these temporary
> > mappings done, and for what purpose.  Would these temporary mappings
> > take place when user processes require space?
>
> The temporary mappings are done when the kernel needs to access
> memory above the 896MB boundary.  The kernel needs to do accesses
> when it has to clear out the data in a page before it is given to
> userspace, or when userspace calls sendfile(2) and the kernel has
> to copy data into or out of the page.  There probably are other
> occasions too.

So after the light of infos above, is my general summary correct: a useful 
idea, one-to-one mapping, had some troubles when physical memory past the 
896MB/1GB barrier but then resolved by highmem even if not exactly(Full 
solution is 64 bit)?

--
Bora SAHIN

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux