How to limit the CPU usage for makebuild world?

I run FreeBSD with my laptop, it is so hot when make buildworld. I hope there is a way can limit the CPU usage for makebuild world and also make install clean for ports.

Is that possible?
 
I can accept the slow compilation speed, but the reboot (if the system is too hot, it will reboot). This reboot may destroy my file systems.
 
If you have a multicore CPU you can use [CMD=""]make -j1 buildworld[/CMD] to force only 1 process at any one time.

Code:
 -j max_jobs
             Specify the maximum number of jobs that make may have running at
             any one time.  Turns compatibility mode off, unless the -B flag
             is also specified.

---

If your CPU is supported by the cpufreq framework, you can use it to force CPU itself to slow down.
Check for supported frequency steps with [CMD=""]sysctl dev.cpu.0. | grep freq[/CMD]

Code:
# sysctl dev.cpu.0. | grep freq
dev.cpu.0.freq: 2200
dev.cpu.0.freq_levels: 2200/95000 2000/79848 1800/66229 1000/30917

After powerd is stopped you can use [CMD=""]sysctl dev.cpu.0.freq=1000[/CMD] to force this low frequency.

Code:
#/etc/rc.d/powerd stop
Stopping powerd.
Waiting for PIDS: xxxxx

# sysctl dev.cpu.0.freq=1000
dev.cpu.0.freq: 2200 -> 1000

# sysctl dev.cpu.0. | grep freq
dev.cpu.0.freq: 1000
dev.cpu.0.freq_levels: 2200/95000 2000/79848 1800/66229 1000/30917

Be aware, after reboot the powerd will run again, if it is enabled in /etc/rc.conf

---

Anyway, if your hardware is overheating, something may be wrong with it.
 
User23 said:
If you have a multicore CPU you can use [CMD=""]make -j1 buildworld[/CMD] to force only 1 process at any one time.

Code:
 -j max_jobs
             Specify the maximum number of jobs that make may have running at
             any one time.  Turns compatibility mode off, unless the -B flag
             is also specified.

---

If your CPU is supported by the cpufreq framework, you can use it to force CPU itself to slow down.
Check for supported frequency steps with [CMD=""]sysctl dev.cpu.0. | grep freq[/CMD]

Code:
# sysctl dev.cpu.0. | grep freq
dev.cpu.0.freq: 2200
dev.cpu.0.freq_levels: 2200/95000 2000/79848 1800/66229 1000/30917

After powerd is stopped you can use [CMD=""]sysctl dev.cpu.0.freq=1000[/CMD] to force this low frequency.

Code:
#/etc/rc.d/powerd stop
Stopping powerd.
Waiting for PIDS: xxxxx

# sysctl dev.cpu.0.freq=1000
dev.cpu.0.freq: 2200 -> 1000

# sysctl dev.cpu.0. | grep freq
dev.cpu.0.freq: 1000
dev.cpu.0.freq_levels: 2200/95000 2000/79848 1800/66229 1000/30917

Be aware, after reboot the powerd will run again, if it is enabled in /etc/rc.conf

---

Anyway, if your hardware is overheating, something may be wrong with it.
Or instead, write powerd_flags="-M 1000" into rc.conf which causes powerd to not clock higher then 1000Mhz.

Also, FreeBSD buildworld, unlike ports, uses 1 make job only by default.
 
sounds strange (i.e. faulty hardware)...

what happens if you spawn off one or more:
while :
do
done &

? the machine also reboots after a while ? that's just wrong (poor design)...
 
why not
$nice -n [7-16 positive range] make -j2 blahblah

not sure if clock skewing aka uniceness would affect the results
i'm pretty sure nice doesn't affect much kernel builds on my 386sx
=)
 
I don't think nice(1) will limit CPU cycles. It only affects priorities. It won't prevent 100% of the CPU being used if processes want it.
 
Back
Top