tech-kern archive

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

Re: Zero page

On Feb 2, 2010, at 11:20 AM, Antti Kantee wrote:

> On Wed Feb 03 2010 at 03:55:29 +0900, Masao Uebayashi wrote:
>>> Can't the first XIP device to attach simply allocate it?
>> It's getpages()'s iteration loop which redirects unallocated pages to
>> zero-pages.  If we allocate zero-page in device drivers, we have to
>> have an interface which can be retrieved from vnode or mount.
>> Having a well-known global name is simple, but I'm fine with both.
> I assumed the reason you mentioned #ifdef XIP was because you didn't
> want to waste a whole page of memory on systems which don't use XIP.
> So in my suggestion you'd have a global:
>       struct uvm_page *page_of_blues;
> and then in xip_attach:
>       RUN_ONCE(zeroes, allocate_nothingness);
> Or something like that (you can even refcount it if you want to be
> extra-fancy).  Then you can just always use the global zeropage in xip
> getpages() and don't need to recompile your kernel (and reboot!) to
> support XIP device modules.

I've suggested having a page of zeroes for those who dereference a demand-zero 
page with a read-access.  So it's just not for XIP.

Home | Main Index | Thread Index | Old Index