Subject: Re: Building an alternate backing store.
To: Ben Harris <bjh21@cam.ac.uk>
From: gabriel rosenkoetter <gr@eclipsed.net>
List: tech-kern
Date: 07/13/2000 17:28:04
On Thu, Jul 13, 2000 at 09:52:33PM +0100, Ben Harris wrote:
> Do you mean pmap_enter()?  That's concerned with physically mapping in a
> page at the request of the VM system.  Unless you're planning on having
> hardware assistance for your magic, that's not where you want to be. 
> pmap_enter takes a paddr_t because that's (roughly) what the machine's VM
> hardware uses.  Unless you plan on having some seriously funky hardware
> assistance for your project, you don't want to be messing with
> pmap_enter().

Ahem. Yes, I do mean pmap_entER().

::sigh::

At least there exists no pmap_entRY() (well, that I've seen).

> I suspect what you actually want is somewhere in sys/uvm/uvm_pager.c, but I
> don't know that area very well.
[...]
> You are, at least, berking up the wrong tree.

Perhaps. What I'm really interested in is doing a pagein from something
other than swap.

uvm_pager.c contains just the "generic functions used to assist the
pager". I don't really want to change anything generically, as I only
want to muck with the swap pager (doing evil things to, say, the device
pager would be really bad news).

This led me to uvm_fault.c, and from there to pmap_enter(), since
that's how uvm_fault(), the main entry point for any page fault, goes
about getting memory pages back where they belong from wherever
they've gone. The only calls to anything out of uvm_pager.c made in
uvm_fault() are to uvm_pageralloc(), and that's only in the section
that deals with COW on loaned pages; it sets up an object into which
to copy the written version so that we don't write over the original
(which isn't ours).

Well, those are the only calls that I can see at a glance. There's a
lot here, and I need to look at it more.

Going on the premise that I'm continuing to bark (dogs say "berk" in
the UK? Neat.) up a tree in the wrong park here, I'm going to start
over and re-comprehend uvm_pager.c.

Just to clarify, the cloud's-eye view of what I want to do is this:

The swap pager decides it's time to page out a process. It would
ordinarily do this by writing it to swap space on disk. In my cluster
(yes, I know there are many details of the cluster I'm eliding;
they'll be dealt with later and maybe by others), however, I want the
swap pager to *first* page to pages resident in another machine's
memory. The premise is that network transfer speeds exceed disk
access speeds, and are rising at a greater rate (especially on the
commodity hardware involved).

Figure that the above has already happened through the (in)appropriate
voodoo, and we now page fault into this page that, instead of having
been transfered to swap, has been transfered to another machine.
Obviously, looking for it in swap is futile; we need to ask the other
machine to give it back. That's the step I'm trying to stomp on (the
asking swap for it) with my own routines (the asking the other machine
for it).

This theoretical idea fealt feasible after reading chapter 5 of
McKusick's 4.4BSD, but the book is purposely short on implementational
details. (McKusick is also what original sent me looking in
uvm_fault().)

As near as I can understand, when it goes to actually map a page back
in, uvm_fault() calls pmap_enter() with the physical address of the
page it wants back and the virtual address of where it wants it;
there's no other way to do it.

Hoping I'm still missing the point, re-reading uvm_pager.c...

       ~ g r @ eclipsed.net