merge
This commit is contained in:
commit
c29719ce84
3 changed files with 9 additions and 3 deletions
|
@ -64,7 +64,7 @@ pageinit(void)
|
||||||
print("%ldM swap\n", vkb/1024);
|
print("%ldM swap\n", vkb/1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
pageunchain(Page *p)
|
pageunchain(Page *p)
|
||||||
{
|
{
|
||||||
if(canlock(&palloc))
|
if(canlock(&palloc))
|
||||||
|
|
|
@ -202,6 +202,7 @@ int okaddr(uintptr, ulong, int);
|
||||||
int openmode(ulong);
|
int openmode(ulong);
|
||||||
Block* packblock(Block*);
|
Block* packblock(Block*);
|
||||||
Block* padblock(Block*, int);
|
Block* padblock(Block*, int);
|
||||||
|
void pageunchain(Page*);
|
||||||
void pagechainhead(Page*);
|
void pagechainhead(Page*);
|
||||||
void pageinit(void);
|
void pageinit(void);
|
||||||
ulong pagenumber(Page*);
|
ulong pagenumber(Page*);
|
||||||
|
|
|
@ -313,7 +313,7 @@ static void
|
||||||
imagereclaim(void)
|
imagereclaim(void)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
Page *p;
|
Page *p, *x;
|
||||||
uvlong ticks;
|
uvlong ticks;
|
||||||
|
|
||||||
irstats.calls++;
|
irstats.calls++;
|
||||||
|
@ -329,11 +329,16 @@ imagereclaim(void)
|
||||||
* end of the list (see putpage) so start there and work
|
* end of the list (see putpage) so start there and work
|
||||||
* backward.
|
* 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 && canlock(p)) {
|
||||||
if(p->ref == 0 && p->image && !p->image->notext) {
|
if(p->ref == 0 && p->image && !p->image->notext) {
|
||||||
n++;
|
n++;
|
||||||
uncachepage(p);
|
uncachepage(p);
|
||||||
|
|
||||||
|
/* move to head to maintain the invariant above */
|
||||||
|
pageunchain(p);
|
||||||
|
pagechainhead(p);
|
||||||
}
|
}
|
||||||
unlock(p);
|
unlock(p);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue