4 ms·
It is typical for 64 bit machines to have a direct mapping of physical memory at some virtual offset. Ie, virtual 0xfffff...700000 corresponds to 0x0 physical.
by tedunangst 9y ago
It is typical for 64 bit machines to have a direct mapping of physical memory at some virtual offset. Ie, virtual 0xfffff...700000 corresponds to 0x0 physical. This simplifies some things since you can allocate and access any physical page without creating new mapping.
32 bit machines do not typically have sufficient kernel address space to do the same.
(Oh, linux still uses direct map on 32 bit machines even today, but only maps some memory? I thought that was abandoned, but wouldn't really know. Anyway, a much better explanation of all things direct map is https://www.sceen.net/mapping-physical-memory-directly/ https://www.sceen.net/mapping-physical-memory-directly/)
- bogomipz 9y ago>"This simplifies some things since you can allocate and access any physical page without creating new mapping." I am curious what types of things does this simply for the kernel? When is a physical page allocation ever done that doesn't need to be entered in into a page table entry?
- tedunangst 9y agoptrace of another process, for instance.
- bogomipz 9y agoCan you elaborate? If I strace a process which makes a ptrace system call that is just another userland process and my userland process has a page table entry just like any other userland process.
- tedunangst 9y agoYou call ptrace and ask to read another process's memory. The kernel has to turn the requested VA in that address space into a physical page (walking those page tables, not yours) then copy the memory (from some VA in kernel space). This is quicker if you can turn a PA into a VA by simply adding an offset.
- bogomipz 9y agoI see. I misinterpreted your previous comment. Cheers.