To find the number of cores available to you in Termux you run:

grep Cpus_allowed /proc/self/status

This number of cores is limited in a similar way to running taskset on GNU/Linux.

I am trying to be able to predict what that will return.

According to the app CPU-Z my phone (Huawei Smart P) has 1 HiSilicon Kirin 659 with 8 cores. According to the app CPU Info 4 cores are running the same speed (480-1709Mhz) and 4 cores are running the same speed (1402-2362Mhz).

After booting the phone and waiting 5 minutes to make sure all startup tasks have been started/completed I started Termux, login through ssh and got:

Cpus_allowed_list:       0-7

Which is exactly what I expect.

But if I press the home key, I get:

Cpus_allowed_list:      2-3

I thought this might have to do with how hard the cores are loaded, so I switched to Termux again, started 16 bzip2s. This does not change the number of cores I get immediately. But after 30s I get 4 cores:

Cpus_allowed_list:     0-3

And yet later I get bumped back to 2 cores:

Cpus_allowed_list:      2-3

This behaviour happens through ssh whether Termux is in the foreground or background.

The effect of the home key is only when running Termux: If I run CPU Info, then press home and then start Termux, then Termux still has 8 cores:

Cpus_allowed_list:       0-7

Only when I switch away from Termux using the home key, the app-list key, or the back key does the number of CPUs change.

Software controlled big.LITTLE could explain going from 8 to 4 cores if the limit was not enforced immediately after boot, but only activated later. Since the limit is not activated 5 minutes after boot, I think it is safe to reject this as the explanation. Also it does not explain limiting to 2 cores some of the time when running 16 bzip2s.

What is causing the phone to limit me from using 8 cores? How can I tell the phone not to do so? What is causing the limit to jump between 2 and 4 cores at seemingly random intervals?

(On top of this I had expected the cores to run at 100% speed which also does not happen).

The limitation does not happen if not run through ssh or if run in a tmux session where the tmux session is started via the terminal on the phone.

  • The CPU is an Octa core with BIG-little concept. Therefore this answer also applies to your CPU.
    – Robert
    Mar 3, 2019 at 12:06
  • @Robert IF it was a big.LITTLE CPU why do I get 0-7 after boot? It stays that way if I do not press home. top clearly shows 8 CPUs running 100%. Also that would not explain why I am limited to only 2 cores some of the time.
    – Ole Tange
    Mar 3, 2019 at 12:47
  • I would assume that the device starts without specific CPU assignments. This also makes the boot as fast as possible. Afterwards (may be by the start of a special service) it applies the power configuration to limit the power consumption. New processes start with 2 cores and after 30 seconds of high cpu usage all 4 fast cores are allowed. Keep in mind that Smartphones are optimized for UI responsiveness, not for max CPU throughput.
    – Robert
    Mar 3, 2019 at 12:54
  • @Robert I have updated the question. The big.LITTLE explanation does not seem to fit the evidence.
    – Ole Tange
    Mar 3, 2019 at 14:11

2 Answers 2


What is causing the phone to limit me from using 8 cores?

Linux Control Groups (cgroups). Android uses them to control how much resources a process can use. In particular the processes of apps are assigned to different cgroups depending on their lifecycle, which usually depends on the app's interactivity with the user.

For instance an app being actively used in foreground needs more processing power than the one staying idle in the background. So Android creates multiple descendant sub-cgroups for different states of the app (and non-app) processes:

~# grep . /dev/cpuset/*/cpus

cpuset is one of the multiple types of cgroups Android uses for different purposes.

As you can see that the apps in background are allowed to use only 2 (out of 8) CPUs, those running a foreground service can use 7 CPUs, while the top apps can use all CPUs. Android framework continuously switches the PID of an app between these sub-cgroups as the app changes its state.

Note that:

  • Different vendors may configure the cgroups differently depending on the number of available CPU cores on the device.
  • Setting CPU affinity of a task using taskset is filtered to just those CPUs allowed in that task’s cpuset.

How can I tell the phone not to do so?

The best way would be to modify the code and rebuild the ROM so that it no more uses the cgroups (or uses them the way you want). Or simply change the CPU values in the files shown above, hoping that they won't revert back.

But for a normal user this would do more harm than good, consuming more resources and badly affecting the device performance.


  • u0_a164@localhost:~$ grep . /dev/cpuset/*/cpus gives grep: /dev/cpuset/*/cpus: No such file or directory
    – Ole Tange
    May 25, 2022 at 16:02
  • @OleTange filesystem might be mounted somewhere else. E.g. in /sys/fs/cgroup. Check with mount | grep cgroup. Also you might need root privileges or permissive SELinux to access the directory. May 25, 2022 at 16:13

Summary: the more cores you use the more battery you consume so CPU hotplugging turns off the other cores, and the others do the work which makes them at 100% CPU usage, which also give the best performance and the most balanced one.

It's CPU hotplug It turns on and off the cores when needed or not.

It's running 100% CPU usage because it's like this. Imagine, there's a 4 car, and let's assume the drivers are the cores. You have four lanes and 4 cars of course. Each one of them will take 100 pizzas. You can let one core to do all the work and that's what hot plugging do. Knowing that a car with 50 pizzas consumes a lot less fuel than a car with 100 pizzas you can now see how we can have the same performance and save on fuel: load two cars with 50 pizzas and let them accelerate as quickly as possible to the destination (performance governor). They will get there as quickly as one car with 100 pizzas (same performance), but burn less fuel (battery saving).

If you want to make your phone run at 8 cores then you need to install a custom kernel, use an other CPU governor, use a custom CPU hotplugging, or without installing a custom kernel use an interactive governor, then tweak its parameters. You can search on XDA for Advance Interactive governor tweaks.

  • 1
    Further, what do you think gives "best balance performance" on high load? Certainly not disabling cores. And 16 bzip2 processes certainly need more than 3 cores for "good performance". So could you please explain – and back your claim?
    – Izzy
    Mar 2, 2019 at 18:13
  • Use an interactive governor then tune its parameters
    – Sean
    Mar 2, 2019 at 18:18
  • Its the way your kernel turn on and off the cores if its needed or not in the bootup all cores are on because android bootup are sometimes slow so developers try to turn on all the cores to make it boot faster
    – Sean
    Mar 2, 2019 at 18:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .