Re: Address spaces
From: Pete Zaitcev (zaitcev_at_yahoo.com)
Date: Wed, 03 Dec 2003 13:36:14 -0800
On Wed, 03 Dec 2003 19:31:57 +0000, Ivan Van den Bossche wrote:
> Could somebody explain me the purposes of:
> * vmalloc address space
> * kmap address space
> * Fixed Virtual Address Mapping
> These are all used in the Linear address space of the Linux Kernel.
First of all, traditionally, when a Linux hacker mentions
"linear mapping", he means the fixed map at PAGE_OFFSET.
IMHO, it would be best not to use CPU-specific "linear"
anywhere near Linux to avoid confusion. Just call it "lowmem".
The main purpose of this mapping is, well, to map everything.
On some architectures, notably i386, high end machines have
more memory than fits into the lowmem range, so the rest
has to be remapped on demand, UNIX-style. It's called "highmem"
and supported by kmap framework.
The vmalloc is different. Its purpose is to create virtually
contiguous mapping of disjoint physical pages for the use by
kernel. Thus, it's different from kmap in two aspects:
a) If something is kmap-ped it cannot be simultaneously
present in any other mapping, such as lowmem, and
b) kmap only contains highmem pages of RAM, but vmalloc
contains all sorts of crap, including MMIO.
Historically vmalloc was used to load kernel modules,
but some people considering themselves clever started
to abuse it for all sorts of things. This is not a good idea,
in particular because there all sorts of kernel APIs
expect either lowmem or highmem, but not vmalloc
(in particular, DMA and address translations).
Another reason is that on some architectures vmalloc is
very scarce, and should not be wasted. The i386 usually
offers about 128MB in total for modules and ioremap.