Persistent Kernel Mappings

The kmap function must be used if highmem pages are to be mapped into kernel address space for a longer period (as a persistent mapping). The page to be mapped is specified by means of a pointer to page as the function parameter. The function creates a mapping when this is necessary (i.e., if the page really is a highmem page) and returns the address of the data.

This task is simple if highmem support is not enabled. In this case, all pages can be accessed directly so it is only necessary to return the page address; there is no need to create a mapping explicitly.

The situation is more complicated if highmem pages are actually present. As with vmalloc, the kernel must first establish an association between the highmem pages and the addresses at which they are mapped. An area in virtual address space must also be reserved to map the pages, and finally, the kernel must keep track of which parts of the virtual area are already in use and which are still free.

Continue reading here: Data Structures

Was this article helpful?

0 0