This commit is contained in:
cinap_lenrek 2014-02-24 22:43:21 +01:00
commit c29719ce84
3 changed files with 9 additions and 3 deletions

View file

@ -64,7 +64,7 @@ pageinit(void)
print("%ldM swap\n", vkb/1024);
}
static void
void
pageunchain(Page *p)
{
if(canlock(&palloc))

View file

@ -202,6 +202,7 @@ int okaddr(uintptr, ulong, int);
int openmode(ulong);
Block* packblock(Block*);
Block* padblock(Block*, int);
void pageunchain(Page*);
void pagechainhead(Page*);
void pageinit(void);
ulong pagenumber(Page*);

View file

@ -313,7 +313,7 @@ static void
imagereclaim(void)
{
int n;
Page *p;
Page *p, *x;
uvlong ticks;
irstats.calls++;
@ -329,11 +329,16 @@ imagereclaim(void)
* end of the list (see putpage) so start there and work
* backward.
*/
for(p = palloc.tail; p && p->image && (n<1000 || !imagealloc.free); p = p->prev) {
for(p = palloc.tail; p && p->image && (n<1000 || !imagealloc.free); p = x) {
x = p->prev;
if(p->ref == 0 && canlock(p)) {
if(p->ref == 0 && p->image && !p->image->notext) {
n++;
uncachepage(p);
/* move to head to maintain the invariant above */
pageunchain(p);
pagechainhead(p);
}
unlock(p);
}