bcm kernel: add *kernelpercent option for cmdline.txt
This commit is contained in:
parent
fd112b949f
commit
d8035a86f7
1 changed files with 20 additions and 4 deletions
|
@ -425,11 +425,16 @@ userinit(void)
|
||||||
void
|
void
|
||||||
confinit(void)
|
confinit(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i, userpcnt;
|
||||||
ulong kpages;
|
ulong kpages;
|
||||||
uintptr pa;
|
uintptr pa;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
if(p = getconf("*kernelpercent"))
|
||||||
|
userpcnt = 100 - strtol(p, 0, 0);
|
||||||
|
else
|
||||||
|
userpcnt = 0;
|
||||||
|
|
||||||
if(0 && (p = getconf("service")) != nil){
|
if(0 && (p = getconf("service")) != nil){
|
||||||
if(strcmp(p, "cpu") == 0)
|
if(strcmp(p, "cpu") == 0)
|
||||||
cpuserver = 1;
|
cpuserver = 1;
|
||||||
|
@ -465,8 +470,19 @@ confinit(void)
|
||||||
conf.npage += conf.mem[i].npage;
|
conf.npage += conf.mem[i].npage;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf.upages = (conf.npage*80)/100;
|
if(userpcnt < 10)
|
||||||
conf.ialloc = ((conf.npage-conf.upages)/2)*BY2PG;
|
userpcnt = 60 + cpuserver*10;
|
||||||
|
kpages = conf.npage - (conf.npage*userpcnt)/100;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* can't go past the end of virtual memory
|
||||||
|
* (ulong)-KZERO is 2^32 - KZERO
|
||||||
|
*/
|
||||||
|
if(kpages > ((ulong)-KZERO)/BY2PG)
|
||||||
|
kpages = ((ulong)-KZERO)/BY2PG;
|
||||||
|
|
||||||
|
conf.upages = conf.npage - kpages;
|
||||||
|
conf.ialloc = (kpages/2)*BY2PG;
|
||||||
|
|
||||||
/* only one processor */
|
/* only one processor */
|
||||||
conf.nmach = 1;
|
conf.nmach = 1;
|
||||||
|
@ -494,7 +510,7 @@ confinit(void)
|
||||||
+ conf.nproc*sizeof(Proc)
|
+ conf.nproc*sizeof(Proc)
|
||||||
+ conf.nimage*sizeof(Image)
|
+ conf.nimage*sizeof(Image)
|
||||||
+ conf.nswap
|
+ conf.nswap
|
||||||
+ conf.nswppo*sizeof(Page);
|
+ conf.nswppo*sizeof(Page*);
|
||||||
mainmem->maxsize = kpages;
|
mainmem->maxsize = kpages;
|
||||||
if(!cpuserver)
|
if(!cpuserver)
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue