MM with fragmented memory

Werner Almesberger (almesber@lrc.di.epfl.ch)
Thu, 22 Oct 1998 09:50:56 +0200 (MET DST)


[ Posted to linux-kernel and linux-7110 ]

I'd like to get some opinions on what could be a reasonable memory mapping
for the Psion S5. The problem with this device is that its physical RAM is
scattered over a 30 bit address space in little fragments of 512kB,
aligned to multiples of 1MB. Since it's impossible to fit any useful
kernel into 512kB, some creative memory layout is necessary.

I can see two viable approaches:

(1) play linker tricks and insert holes in the kernel such that it skips
over the gaps in memory. Then map all the memory 1:1 and let
start_mem and end_mem each have one of the 512kB fragments for
linear allocation.
(2) use the MMU to create virtually continuous memory and let the kernel
manage that in the usual way.

The problems I see with (1) are:
- at least part of the memory layout needs to be known when linking the
kernel
- allocations from start_mem and end_mem are each limited to a total of
512kB
- need to re-arrange VMALLOC_END, because on ARM-Linux it's 256 MB after
PAGE_OFFSET, but VMALLOC_START will already have to be about 278 MB
after that, due to the "exploded" address space. (But that change may
be harmless.)
The problems I see with (2) are:
- virt_to_phys and phys_to_virt now need to perform lookups (in (1)
they're no-ops). With a few tricks, I can get each of them done in
about 10 clock cycles, clobbering two registers (out of 16), and
accessing memory once
- a little voice in the back of my head saying that something in the
kernel will certainly trip over a virtual:physical mapping that isn't
just an offset

While I'm attracted by the simplicity of (1), I'm a little worried about
the limitation for linear allocations. Also, initrd needs a little work
to function in such a scenario.

The disadvantage of (2) is clearly its complexity. Also, I don't like
what that little voice is saying ...

Any suggestions ?

Thanks,
- Werner

-- 
  _________________________________________________________________________
 / Werner Almesberger, DI-ICA,EPFL,CH   werner.almesberger@lrc.di.epfl.ch /
/_IN_R_131__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/