Re: Question on mmap() in 64-bit OS



LaBird wrote:

Dear all,

I'd like to ask is there any address range limit allowable to
be used by user when calling mmap() with the MAP_FIXED flag on
in a 64-bit Linux machine. (I am using Fedora 7). I find that I
cannot go anywhere beyond 0x10000000 00000000. When I specify
any address larger than that, a ENOMEM error occurs. If that is
the case, why does the OS need to reserve such a large portion
of the 2^64 address space, prohibiting users to map in that
range?

It's not the OS, which sets the limit. It's the CPU: AMD64 CPUs
(that are also Intel Core2) actually have "only" 48 bit wide
memory address busses. Technically the paging system of AMD64
would allow to map those 2^48 byte anywhere in the 2^64 range.
But why should things be complicated? The bottom 2^47 bytes are
for the user space, the top 2^47 bytes are for the kernel space
(as seen from programs in user mode). Keep it simple, stupid
(KISS).

The kernel has a slightly different view on the memory space. The
bottom 16MiB contain a lot of HW related stuff, then somewhere
inbetween come PCI memory mappings and so on. But all this is
covered by kernel memory mangement and will never bother you, no
matter if you do user space programming, or kernel space
programming, if you stick to use only the kernel's memory
management (which you'll do).

Wolfgang Draxinger
--
E-Mail address works, Jabber: hexarith@xxxxxxxxxx, ICQ: 134682867

.



Relevant Pages