kernel address mapping question

Matthew Dillon dillon at apollo.backplane.com
Thu Feb 23 12:29:08 PST 2006


:
:Is there a 1:1 mapping between physical addresses and kernel virtual
:addresses? Or said a different way, can 2 kernel virtual addresses map
:to the same physical address? Does the answer differ depending on
:whether malloc(9) or bus_dmamem_alloc(9) are used? TIA.
:
:---chuck

    Two KVA addresses *CAN* map to the same physical address.  In addition,
    mappings in the user VM area can also map to the same physical address
    as mappings in KVM.  For example, if a userland mmap()'s a file and
    portions of that file might also reside in the buffer cache.

    Kernel examples include generic mappings made via the SFBUF and MSFBUF
    mapping interfaces, mappings by device drivers, mappings made to
    support 0-copy socket operations (mappings for mbufs), and so forth.  

    Another example would be when the buffer cache is used with block sizes
    which are not integral multiples of PAGE_SIZE.  For example, certain
    areas of the UFS filesystem use 6144 byte blocks.  In this case two 
    adjacent buffers will remap the physical memory page that both buffers
    share.

    On 64 bit architectures all of physical memory is mapped into a big
    contiguous section of virtual memory, in addition to all the other 
    mappings the kernel makes.

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>





More information about the Kernel mailing list