News: 1720014070

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

Kernel tweaks improve Raspberry Pi performance, efficiency

(2024/07/03)


Two separate development efforts are improving both Raspberry Pi power management and memory efficiency – one using tools built for massive clusters.

One [1]set of kernel patches adds "Suspend to idle" (s2idle) support to the kernel for older Pi models. The [2]other patch , from Igalia, brings NUMA support to the Pi 5, which rather unexpectedly boosts performance. As The Register [3]explained back in 2013 , NUMA is a technology more usually seen in clusters, short for non-uniform memory access.

First the power management support. Although the Pi series are based on mobile phone tech, they are effectively tiny desktop devices, mainly intended to run off the mains. The new code supports Pis based around the Broadcom BCM2835 SoC. This is the older SoC used in the Raspberry Pi 1, 2, and 3, so for now, this won't help newer Pi 4 or 5 hardware. Developer Stefan Wahren chose to target the older models first because more documentation is available for them.

[4]

S2idle is one of four common types of ACPI suspend states, as [5]explained by the Arch wiki . For reasons we're sure made sense to someone somewhere, the levels are known as S0, S1, S3, and S4, and if that doesn't make you twitch, then you may enjoy knowing that s2idle support puts the machine into the S0 state, and not S2, because there isn't an S2 level.

[6]

[7]

Broadly, S0 – known as "freeze" – stops the machine from running. In theory, it also puts IO devices to sleep, but that doesn't work on the Pi's USB controller just yet. For completeness, S1 is "shallow" sleep, or standby mode. S3 is "deep" sleep, or suspend-to-RAM, and S4 is suspend-to-disk or hibernation.

Some of this is handled by firmware on PCs, especially in laptops, but as [8]we have covered before , firmware and Linux driver support for Arm-based systems is a lot more complicated than in the relatively homogeneous x86 world.

[9]

These are early days and the power usage drop is modest, only about a third of a Watt. Wahren reports that a Pi 1 doing nothing drew 1.67 W, which dropped to 1.33 W when suspended. Even so, it's a step in the right direction, and if this becomes a standard kernel feature, it could reduce the power usage of millions of Pis out there.

The other interesting Pi development in kernel land is that enabling NUMA support lets the Pi 5 run faster. NUMA itself is nothing new to Linux – The Reg was [10]reporting on IBM working on Linux NUMA support a quarter of a century ago. The gist is that in a system comprising lots of machines, each with multiple multi-core processors, the speed of access to memory will probably differ from one core to another, which may still be faster than from one physical CPU socket to another on the same motherboard – and that will be orders of magnitude faster than accessing RAM on another node.

Surprisingly, emulating this really helps the modest BCM2712 SoC inside the Pi 5, as developer Tvrtko Ursulin explains in the patch notes:

This series adds a very simple NUMA emulation implementation and enables selecting it on arm64 platforms.

Obvious question is why? Short answer – it can bring a significant performance uplift on Raspberry Pi 5.

Longer answer is that splitting the physical RAM into chunks, and utilizing an allocation policy such as interleaving, can enable the BCM2712 memory controller to better utilize parallelism in physical memory chip organisation.

In more concrete numbers, testing with Geekbench 6 shows that splitting into four emulated NUMA nodes can uplift the single core score of the benchmark by around 6 percent, and the multi-core by around 18 percent.

[11]Linux geeks cheer as Arm wrestles x86

[12]Apple's Macintosh 128K on a Pi Pico gets thumbs-up from Upton

[13]Raspberry Pi stock surges after London IPO

[14]Raspberry Pi unveils Hailo-powered AI Kit to make the model 5 smarter

For The Reg FOSS desk, considering these two patches together gives a pleasing example of the benefits of a single OS that can run on anything from a mobile phone to a supercomputer cluster. Adapting laptop-style power management to tiny single-board computers can drop their power usage, which could result in big savings if deployed to large clusters. Conversely, adapting memory management algorithms designed for large clusters can measurably improve the performance of the same family of tiny SBCs.

We really want to see much more aggressive power management brought to server OSes – the sort of stuff that makes pocket fondleslabs last longer – deployed in datacenters. While corporates have for [15]many years been [16]talking about carbon offsetting, it's bogus, it [17]doesn't help . Many times, it has been [18]shown to be [19]ineffective . Meanwhile, [20]datacenter emissions are rising .

[21]

Despite a [22]decade of Kubernetes , most people using it [23]still don't need it (even when the results are amusing). The world would benefit more from focusing on datacenter computing that scaled down rather than up and out. ®

Get our [24]Tech Resources



[1] https://lore.kernel.org/dri-devel/20240630153652.318882-1-wahrenst@gmx.net/T/#ma0791259e7b745f6b97d3271dd80bee90972d6d4

[2] https://lore.kernel.org/lkml/20240625125803.38038-1-tursulin@igalia.com/

[3] https://www.theregister.com/2013/06/10/google_boasts_of_app_tuning_prowess_on_warehouse_scale_clusters/

[4] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_onprem/personaltech&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=2&c=2ZoV1oITlyQ@Dkl@jj4UecQAAAJA&t=ct%3Dns%26unitnum%3D2%26raptor%3Dcondor%26pos%3Dtop%26test%3D0

[5] https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate

[6] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_onprem/personaltech&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44ZoV1oITlyQ@Dkl@jj4UecQAAAJA&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0

[7] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_onprem/personaltech&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=3&c=33ZoV1oITlyQ@Dkl@jj4UecQAAAJA&t=ct%3Dns%26unitnum%3D3%26raptor%3Deagle%26pos%3Dmid%26test%3D0

[8] https://www.theregister.com/2022/03/03/armbian_project_releases_version_2202/

[9] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_onprem/personaltech&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44ZoV1oITlyQ@Dkl@jj4UecQAAAJA&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0

[10] https://www.theregister.com/2000/05/26/ibm_makes_numa_linuxfriendly/

[11] https://www.theregister.com/2024/06/24/arm_linux_x86/

[12] https://www.theregister.com/2024/06/18/apples_macintosh_128k_on_a_pico/

[13] https://www.theregister.com/2024/06/11/raspberry_pi_stock_surges_after/

[14] https://www.theregister.com/2024/06/04/raspberry_pi_ai_kit/

[15] https://www.theregister.com/2006/06/12/green_pcs/

[16] https://www.theregister.com/2023/05/24/atlassian_sustainability_guide/

[17] https://www.theregister.com/2006/12/18/carbon_trees/

[18] https://australiainstitute.org.au/post/here-are-23-times-carbon-offsets-were-found-to-be-dodgy-2/

[19] https://www.climatechangenews.com/2023/10/05/exposed-carbon-offsets-linked-to-high-forest-loss-still-on-sale/

[20] https://www.theregister.com/2024/07/02/google_datacenter_emissions/

[21] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_onprem/personaltech&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=3&c=33ZoV1oITlyQ@Dkl@jj4UecQAAAJA&t=ct%3Dns%26unitnum%3D3%26raptor%3Deagle%26pos%3Dmid%26test%3D0

[22] https://www.theregister.com/2024/06/12/kubertenes_decade_anniversary/

[23] https://www.theregister.com/2021/07/22/ably_doesnt_need_kubernetes/

[24] https://whitepapers.theregister.com/



Anything that makes CPUs run at lower power is all right with me

Neil Barnes

The holy grail in the day job is building systems that idle at less than the batteries self-discharge...

Re: Anything that makes CPUs run at lower power is all right with me

Martin Gregorie

That sounds like both an interesting and a very worthwhile project.

I've got several items, ranging from digital stopwatches, radio trackers and mobile phones to portable and panel-mounted GPS navigation systems and cameras that would all benefit from reduced idle power consumption, even if the only benefit is a considerably longer interval between charges when they're not being used.

For instance, my Panasonic TZ-70 camera has a 1000mAh Li-ion battery which is continuously discharging when it is installed in the camera. This is the case even when the camera is turned off, because its power switch (a single touch button that turns the camera both on and off) must be powered in order to detect when the power button is touched. Consequently, if I don't recharge the camera every six months or so, or store it with battery removed, it will no longer turn on and its battery will probably have self-destructed after a year or so.

The same issue will apply to many of the battery-powered DEVICES we all use.

NUMA improving performance on RPi5

Bebu

Seems odd but it might make sense as I commented last week on the story run on Phoronix [1]numa emulation yields significant performance uplift to raspberry pi 5 although I haven't looked at Linux kernel code since trying to get a non DEC adaptor in a DEC Alpha desktop to work under Redhat Linux 7.2 (*not* RHEL 7.2) so am definitely not the full bottle.* :(

* some might also say quid.

[1] https://www.phoronix.com/forums/forum/hardware/processors-memory/1473253-numa-emulation-yields-significant-performance-uplift-to-raspberry-pi-5?p=1473408#post1473408

:) Agreed

3arn0wl

@Liam :) I wholeheartedly share your thoughts on power management.

Iirc... Wasn't power management an issue for the PinePhone? I realise it's a completely different SBC, but perhaps it can reap some benefit from this initiative too...

"Broadly, S0 – known as "freeze" – stops the machine from running"

Mike 137

A nice way to save power in general, as long as one can optionally disable it. In time-dependent embedded applications, provided it runs continuously the processor tick count can be a used as a high resolution time reference after synchronising it to clock time. "Freeze" would obviously interfere with that.

Re: "Broadly, S0 – known as "freeze" – stops the machine from running"

druck

Even having the WiFi in power saving mode causes quit a bit of jitter when Pi's are polled for sensor readings by a central controller.

Law stands mute in the midst of arms.
-- Marcus Tullius Cicero