# powerd and boinc_client



## pbd (Jan 28, 2010)

Hi,

I have powerd() enabled with default options and it works fine. But, I also run net/boinc-client (via idprio(), so it doesn't slow down other processes). Problem is that net/boinc-client takes cpu load to 100% all the time which triggers powerd() to switch cpu to highest frequency.

Is there any other way, than to modify powerd() so that it distinguishes processes with idle priority, to run some process which takes all cpu time and not to trigger frequency increase?

Thanks.


----------



## Graaf_van_Vlaanderen (Jan 28, 2010)

Just curious, could you post top output, something like:


```
$ top -uP
```

From what I read in the man pages:


```
-i percent  Specifies the CPU load percent level when adaptive mode should begin to degrade performance to save power. The default is 50% or lower.
```



> -r percent  Specifies the CPU load percent level where adaptive mode
> should consider the CPU running and increase performance.
> The default is 75% or higher.




So if I understand correctly the system is on a average loaded more than 50 percent. Unless load glitches are altering this number. You could also check the output as a root:


```
# powerd -v
```

You can also change the CPUs upper clock frequency to a lower one. For example:

```
# sysctl dev.cpu.0.freq=2800
```


----------



## pbd (Jan 28, 2010)

Graaf_van_Vlaanderen said:
			
		

> Just curious, could you post top output, something like:
> 
> 
> ```
> ...



I want this situation to be considered as the cpu is *idle*:


```
last pid: 47075;  load averages:  3.10,  3.10,  3.69
97 processes:  3 running, 94 sleeping
CPU 0:  [color="Red"]2.2% user[/color], [color="Red"]97.0% nice[/color],  0.7% system,  0.0% interrupt,  0.0% idle
CPU 1:  [color="Red"]1.5% user[/color], [color="Red"]95.9% nice[/color],  1.5% system,  1.1% interrupt,  0.0% idle
Mem: 468M Active, 1060M Inact, 195M Wired, 3336K Cache, 112M Buf, 638M Free
Swap: 2048M Total, 2048M Free

  PID    UID    THR PRI NICE   SIZE    RES STATE   C   TIME   WCPU COMMAND
36297   1103      2  76  i31 45104K 37128K nanslp  0   3:45 75.68% setiathome-6.8.i386
36298   1103      2  76  i31 52272K 44244K nanslp  0   3:41 70.17% setiathome-6.8.i386
 2339   1001     11  44    0   240M   182M ucond   0  25:00  0.00% firefox-bin
 1993      0      1  44    0 88016K 55460K select  0   6:07  0.00% Xorg
...
```

And this to be considered as *under load*:


```
last pid: 54143;  load averages:  4.56,  3.37,  3.63
111 processes: 8 running, 103 sleeping
CPU 0: [color="Red"]71.2% user[/color], [color="Red"]19.9% nice[/color],  8.2% system,  0.7% interrupt,  0.0% idle
CPU 1: [color="Red"]95.9% user[/color],  [color="Red"]0.0% nice[/color],  4.1% system,  0.0% interrupt,  0.0% idle
Mem: 497M Active, 1272M Inact, 189M Wired, 2184K Cache, 112M Buf, 403M Free
Swap: 2048M Total, 2048M Free

  PID    UID    THR PRI NICE   SIZE    RES STATE   C   TIME    CPU COMMAND
36298   1103      2  76  i31 52272K 44244K nanslp  0   6:03 25.29% setiathome-6.8.i386
36297   1103      2  76  i31 45104K 37128K nanslp  0   5:42 18.16% setiathome-6.8.i386
54138      0      1  96    0 34796K 29324K CPU1    1   0:00  4.05% cc1plus
 2339   1001     10  44    0   240M   182M ucond   0  25:03  0.00% firefox-bin
...
```

(note the difference between _user_ and _nice_ load)



			
				Graaf_van_Vlaanderen said:
			
		

> From what I read in the man pages:
> 
> (...)
> 
> ...



I know powerd()'s options, but the currently supported cannot be used since under the way it determines cpu load, it is allways 100% (or 200% in this case on machine with two cpus):


```
# powerd -v
powerd: using sysctl for AC line status
powerd: using devd for AC line status
load 200%, current freq 1600 MHz ( 0), wanted freq 3200 MHz
load 200%, current freq 1600 MHz ( 0), wanted freq 3200 MHz
load 200%, current freq 1600 MHz ( 0), wanted freq 3200 MHz
...
```


----------



## SirDice (Jan 28, 2010)

The two are more or less mutually exclusive. The whole purpose of bionc is to use (unused) CPU cycles. Even if you nice the process it'll still use all CPU cycles. Using nice on a process only means other processes will get more CPU when they need to.


----------



## pbd (Jan 28, 2010)

SirDice said:
			
		

> The two are more or less mutually exclusive. The whole purpose of bionc is to use (unused) CPU cycles. Even if you nice the process it'll still use all CPU cycles. Using nice on a process only means other processes will get more CPU when they need to.



I understand, but theoretically, [cmd=]powerd[/cmd] can be modified to lower CPU frequency if the only processes that uses CPU cycles has an idle priority, couldn't it?


----------



## SirDice (Jan 28, 2010)

pbd said:
			
		

> I understand, but theoretically, [cmd=]powerd[/cmd] can be modified to lower CPU frequency if the only processes that uses CPU cycles has an idle priority, couldn't it?



Not sure, but I don't think boinc has an idle priority. It just runs and eats CPU cycles. The reason you would use nice is to make it interfere less with the other processes on the box.


----------



## pbd (Jan 28, 2010)

Hmm.. I'll try to make a patch for [cmd=]powerd[/cmd].


----------

