calculate the real number of pages used by segments and use it for killbig and proc

This commit is contained in:
cinap_lenrek 2011-08-26 04:47:34 +02:00
parent 00161ca7fc
commit a6e3c9fd83
5 changed files with 34 additions and 10 deletions

View file

@ -510,6 +510,27 @@ ibrk(ulong addr, int seg)
return 0;
}
/*
* called with s->lk locked
*/
int
mcountseg(Segment *s)
{
int i, j, pages;
Page **map;
pages = 0;
for(i = 0; i < s->mapsize; i++){
if(s->map[i] == 0)
continue;
map = s->map[i]->pages;
for(j = 0; j < PTEPERTAB; j++)
if(map[j])
pages++;
}
return pages;
}
/*
* called with s->lk locked
*/