Taskaffctl, a tool to keep background tasks on Zen 5c cores on the Framework laptop

Back in April, I wrote a small Linux tool called taskaffctl, and I have been using it successfully for the past few months on my Framework Laptop 13 with the Ryzen AI 9 HX 370.

One of my biggest complaints with this machine was that background work such as Syncthing could wake the full Zen 5 cores and push them beyond 5 GHz. That made the laptop boost unnecessarily for work that is not particularly time-sensitive. At the same time, I did not want to restrict the entire CPU to a low-power mode, since interactive and demanding applications should still be able to use the faster cores.

With taskaffctl, I can start Syncthing onto the lower-performance Zen 5c cluster like:

taskaffctl --tag lowest-perf-cores -- syncthing

Linux provides CPU-affinity mechanisms, but identifying the correct CPUs on this hardware is awkward. On my HX 370, the exposed cluster_id is the same across the CPUs, so it does not describe the actual Zen 5 and Zen 5c split.

The distinction is visible through the shared L3-cache topology, however. taskaffctl uses that to identify clusters, then uses ACPI CPPC performance data to label the higher- and lower-performance clusters. It can launch a command with the selected affinity or update an existing process and all its current threads.

It is a small tool written in Go and released under the BSD license:

It works great for me, and I hope some of you might also find it useful. It has only been tested on Zen 5-family Ryzen systems so far, so if anyone has a Framework with a Panther Lake Intel CPU and is willing to test it, I would be very interested in your results, even just the output of taskaffctl --topology.

5 Likes

The mainline amd_pstate driver is getting support for the 3rd tier of cores (along with existing two tier perfcore hints structure, there is now a 3rd tier low-power tier) his should land in 7.2 or 7.3 and should make things ‘just work’ for most users.

3 Likes

Man I am looking forward to zen6, sounds like they are trying to address most of the previous shortcomings

Hello, are you talking about this this https://www.phoronix.com/news/AMD-Low-Power-Core-Linux-7.3 ?

Yup that would be them.

I am looking at https://www.phoronix.com/news/AMD-Low-Power-Core-Linux-7.3 and the way I understood it is that next-gen AMD CPUs with have 3rd type of cores, unsure how scheduler will work with them. The idea behind taskaffctl was to force a workload into efficient cores, so on my Framework those are the Zen 5c that does not boost past 3 GHz. The syncthing that I sent to run on them can grind 100% lf all cores for hour or so, but I do not want this to make my laptop into angry hairdryier. Unless I misunderstood and the new amd_pstate have way to assign a task a true background priority, like PRIO_DARWIN_BG on MacOS, which limits the workload to the efficency cores, Linux does not currently have anything like that, sadly.

1 Like