l4-hurd
[Top][All Lists]
Advanced

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

Re: self-paging


From: Emmanuel Colbus
Subject: Re: self-paging
Date: Sun, 11 Dec 2005 12:32:18 +0100
User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)

Jonathan S. Shapiro a écrit :

Well, if the keeper doesn't know the order of page arrival, how
does it decide what to throw out? Suppose we wanted to implement
LRU in the keeper, for example. How does it know?
It uses the "accessed" bit in the page table entry : if it is 0, the page
hasn't been accessed since the last time the keeper set it to 0, so its
new age is "previous age + 1 keeper cycle time"; if it is 1, its new age
is 0. At page arrival, "previous age" is set to 0 (or was set to 0 for long,
because it is also the value for unused pages); but the keeper can't
differentiate such a page from a recently accessed one.
The keeper is not in the kernel. It does not have the ability to examine
the hardware page table state.


Oh, it's not in the kernel... That's more difficult (for me! :-) ). But
I continue to think that, to implement a LRU, the keeper needs to know the age of last use of the pages, but not their order of arrival. He may just need to be notified when some new pages are coming (but maybe it was the point you were refering to?).

So how do you propose that it learn the age of the page? What interface
do you have in mind?

What would you say about something like this :

struct pageage_t {
   int which_page;/* To identify the page. May be replaced by a convention
* about the order of the pages in the main structure. */
   time_t age;/* Or something like this. */
};

struct pageages_t {
   struct pageage_t[];
};

int getpageages(struct pageages_t*, unsigned int pagenum);

getpageages(2) writes the age of pages into the specified buffer in userspace. If "pagenum" is inferior to the total amount of pages, the result is truncated to the first "pagenum" pages, if it is superior to this value, the content of the remainder
of the buffer is undefined.
If pages of the pool are allocated or freed during this call, the result
is undefined /* SMP issue here! */.
If it succeeds, this functions returns the number of written page ages, if it fails,
it returns a negative value and sets errno to contain the error code.

The following errors codes may be returned:
EPERM  the caller is not a registered keeper.
/* And some others errors codes like "this buffer is outside addressable space". */

Every time the keeper would want to know the page ages, which would certainly
be nearly only at memory pressure time, he would just need to ask for it to
the kernel; as you said the kernel had to collect this data anyway.

Maybe it's a little bit slow, but I think it should work.

Note that I'm neither a Hurd developper nor a Coyotos, Mach or L4 one, and that I'm not familiar with microkernels, so the interface I'm proposing may be completely wrong. Oh, and I've supposed there would be one pool per keeper; if it's wrong,
an additionnal pool_ident param would be required.

Your opinion?

Emmanuel









reply via email to

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