[Top][All Lists]

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

Re: providing memory objects to users

From: Neal H. Walfield
Subject: Re: providing memory objects to users
Date: 12 Jun 2002 16:47:08 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.2

> Ok ;)  I do this in my current version, and it seems to work fine.  I will
> check in the code right now, but I have one more question.  When using
> libpager, I must provide my own backing store, right?  At any time, it can
> happen that pager_write_page is called with my pages, and then they are
> removed.

You can use the default pager as your backing store.  When the kernel
asks you to page some data (via memory_object_data_return), more than
just a request is issued.  The kernel actual transfers the data to the
manager.  What this means is that the pages are no longer managed by
the manager but rather the default pager.  memory_object_data_return
is thus nothing more than a nice request.  If the manager decides to
do nothing and hold on to the pages, the kernel hardly notices: the
next time it tries to evict the page, it sends it to the default pager
which is trusted and sends the now anonymous data to swap.

> So I need to provide my own simple backing store for the pages on the one
> hand to save the pages when they are "swapped out", and my own server side
> mapping on the other hand to access the pages.  I will use a malloc'ed
> area as backing store, and make all server side accesses to the buffer
> through the mapping.  Then pager_read_page and pager_write_page only need
> to read from and write to the malloc'ed area.

You do not even have to do this.  Just hold a reference to the regions
returned by pager_write_page; it is up to you to vm_deallocate them.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]