calculate the real number of pages used by segments and use it for killbig and proc
This commit is contained in:
parent
00161ca7fc
commit
a6e3c9fd83
5 changed files with 34 additions and 10 deletions
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue