Disabling cores to reduce the Pi Zero 2 W's power consumption by half

By default, the new Pi Zero 2 W (see my Zero 2 W review here) runs a 4-core ARM Cortex A53 CPU at 1 GHz.

Raspberry Pi Zero 2 W BGA Xray pattern with mini Raspberry Pi Logo

If you haven't seen my full blog post exploring the Zero 2 W from the inside, complete with X-ray imagery—go check it out now!

From my review, I found that the Zero 2 uses 100 mA at idle (compared to 80 mA for the single-core Pi Zero W that preceded it), but will use up to 500 mA full-tilt, when all four CPU cores are maxed out.

For many users of the Zero 2, this is no problem, as the extra multicore performance is worth it. But a few people asked whether disabling cores could save energy in situations where the software running on the Zero 2 wasn't multithreaded or didn't need multiple CPU cores to run effectively.

So I tried it! Booting up a fresh instance of 32-bit Pi OS, I checked on the cores:

pi@zero:~ $ lscpu
Architecture:        armv7l
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):           1
Vendor ID:           ARM
Model:               4
Model name:          Cortex-A53
Stepping:            r0p4
CPU max MHz:         1000.0000
CPU min MHz:         600.0000
BogoMIPS:            38.40
Flags:               half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32

Running stress-ng -c 4 yielded anywhere between 370-460 mA of power consumption, measured by my PowerJive USB power meter—translating to about 2.3W of power usage.

I tried disabling core 3, by running echo 0 > /sys/devices/system/cpu/cpu3/online as root, but got:

root@zero:/home/pi# echo 0 > /sys/devices/system/cpu/cpu3/online
bash: /sys/devices/system/cpu/cpu3/online: Permission denied

So next, I tried using the maxcpus option in the kernel command line. I edited the /boot/cmdline.txt file and added maxcpus=1 after console=tty1, then saved the file and rebooted.

Upon rebooting, I noticed there was only one Raspberry Pi instead of the customary 4 on the HDMI output—a good sign if any!

Raspberry Pi boot logo showing one processor core

I logged in and checked:

pi@zero:~ $ lscpu
Architecture:         armv7l
Byte Order:           Little Endian
CPU(s):               4
On-line CPU(s) list:  0
Off-line CPU(s) list: 1-3
Thread(s) per core:   1
Core(s) per socket:   1
Socket(s):            1
Vendor ID:            ARM
Model:                4
Model name:           Cortex-A53
Stepping:             r0p4
CPU max MHz:          1000.0000
CPU min MHz:          600.0000
BogoMIPS:             64.00
Flags:                half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32

So it looks like that worked! Now, I tried running stress-ng again, and sure enough, the power consumption averaged 200 mA (less than half of the 4-core reading), spiking only as high as 260 mA, so less than 1.3W.

200ma Raspberry Pi Zero 2 with disabled CPU cores power savings

I still couldn't manually bring a core online or offline as root, so it looks like you can only manage them via the kernel cmdline.txt options at boot.

I ran the pts/encode-mp3 test that's part of the Phoronix suite, to see if the performance would match my previous run, and since it's basically a single-threaded test, it did:

MP3 encode benchmark with single-threaded Phoronix text on Pi Zero 2 W with cores disabled

So there you have it—with the Pi Zero 2 W, you can reduce power consumption if you don't need to use multiple cores for your project, by disabling them.

Comments

Interesting - perhaps now this could be packaged into a nice UI element to streamline the process, and make it possible to change the number of CPUs on the go - with just a reboot.

there is also isolcpus kernel parameter, then the cpu is added to list of available cpus but nothing is scheduled to it unless you explicitly do it via sched_setaffinity , that could be a compromise

Thats interesting - Did you ever do a review on what disabling cores on the 4B does?

What was the idle consumption with one core ? Many people use a zero (W) for battery operation where its idle most of the time and then kicks in to do some work based on some IO or timed operation. I was writing off the Zero W 2 as a bit of a gimmick until your test shows that its possible to lower the power consumption. From my understanding, not many micro-controllers can run full linux with all the nice IO, camera CSI & wifi with less power than the zero. Can you actually beat the old Zero W with a new V2 one with the one core set to clock speed to give comparable compute power ?

Oooh interesting, thanks Jeff! I've got a project that runs off PC-supplied USB so try and keep within the 500mA limit - this could be a handy way of gaining more performance without pushing the power demands too high...

Hi Jeff, will you try to setup a script that can set how many cores on next boot, guess most Linux people can edit a file but always good to have something can be use immediately, also ... did you try this on Pi4 or Pi3, when using portable battery it's a great news, thanks for your work.

Was this test run with the Wifi/Bluetooth Enabled or disabled?

Hm, I did some tcp streaming with libcamera in 1920x1080 which consumes around 350-400 mA. Then I disabled two cores it it... was still around 350 - 400 mA (I confirmed the cores were really disabled). In idle it also stayed around 120-130mA for me. I also had the camera and i2c enabled.

So yeah, its very application specific I guess.