tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Introducing non-RAM managed page ("device page")



There are cases where we need to manage addresses of non-RAM devices by MMU.
One example is XIP, which makes kernel able to execute programs directly from
memory-mapped NOR FlashROM instead of copying file into RAM.  Others are newer
video devices (which I'm not familar with).

UVM allocates a managed page's state (struct vm_page) for each page-sized RAM,
because its main purpose is "page cache" - cache of on-disk page-sized data.
OTOH, "device pages" is always volatile.  They're not cache.

So question is, how to represent "device page" struct vm_page?  Keeping struct
vm_page object is a little wasteful & redundant for simple cases where users
needs only physical address of the page.

I'd propose a simple extension to struct vm_page handling.  Make ``struct
vm_page *'' either a pointer to its object *or* a magic integral value, which
contains physical address (or offset of its physical device's base).  Users of
struct vm_page * have to check if it's really a RAM's vm_page, like

        if (uvm_pageisdevice_p(pg)) {
                ...
        }

If anyone knows things I'm missing, please let me know.

Masao


Home | Main Index | Thread Index | Old Index