Skip to contentSkip to conversation

Controlling host CPU utilization (avoiding building on e-cores)

DISCUSSION [email protected] 3 participants 10 messages Jul 2, 2025 – Jul 3, 2025

lore
Share & tools
lore
#0 lore raw

Hello everyone,

I got an Intel 13700H with 6 High performance hyper-threaded cores (so 12 threads) and 8 efficiency atom cores, the 8 efficiency cores are useless but I still want them enabled for background tasks, I am on Kernel 6.8 which supports the scheduler for this processor

I've used
BB_NUMBER_THREADS="12"
BB_NUMBER_PARSE_THREADS="12"
PARALLEL_MAKE="-j 12"
PARALLEL_MAKEINST="-j 12"

in attempt to limit the number of threads available to bitbake in the hopes of the scheduler putting everything on the High performance cores but I still see my entire machine maxed out even on the 8 e-cores

Is there something I am misunderstanding or is there another way to set the affinity of the bitbake environment to just the first 12 threads.

I am probably overthinking this but it never hurts to ask

Thanks

#1 lore raw
Quoted 11 lines · akarnil via lists.yoctoproject.org

I got an Intel 13700H with 6 High performance hyper-threaded cores (so 12 threads) and 8 efficiency atom cores, the 8 efficiency cores are useless but I still want them enabled for background tasks, I am on Kernel 6.8 which supports the scheduler for this processor

I've used
BB_NUMBER_THREADS="12"
BB_NUMBER_PARSE_THREADS="12"
PARALLEL_MAKE="-j 12"
PARALLEL_MAKEINST="-j 12"

in attempt to limit the number of threads available to bitbake in the hopes of the scheduler putting everything on the High performance cores but I still see my entire machine maxed out even on the 8 e-cores

Is there something I am misunderstanding or is there another way to set the affinity of the bitbake environment to just the first 12 threads.

BB_NUMBER_THREADS limits the amount of bitbake tasks running at the same time. Each of those tasks can spawn up to PARALLEL_MAKE make targets. So if there are twelve bitbake tasks, and each of them is compiling a component, you'll have 12*12 compilers running.

You need to use mechanisms outside of bitbake to limit bitbake and its child processes to the cores you wish.

Or ask Witekio for a decent threadripper. It will pay for itself within a month of use.

Alex

#2 lore raw

Thanks for clearing it up Alex

How nice it would be to churn through code with a threadripper

#3 lore raw
In reply to [email protected]

On 02-07-2025 12:50, akarnil via lists.yoctoproject.org wrote:
Hello everyone,

I got an Intel 13700H with 6 High performance hyper-threaded cores (so 12 threads) and 8 efficiency atom cores, the 8 efficiency cores are useless but I still want them enabled for background tasks, I am on Kernel 6.8 which supports the scheduler for this processor

My office machine is similar (i7-12700)

But what you should want is the other way around - the hyperthreading is rather useless for Yocto, it's the "efficiency" cores that you want to run the compiler on.

The high performance cores have fancy instructions for floating-point operations, encryption, gaming and video decoding stuff. These are utterly useless for running GCC and similar compilers.

Just let the operating system handle things for you, it's smart enough to know which tasks should go where. CPU's are also easily shared, so even if you're using all cores, other processes will hardly suffer.

I've limited BB_NUMBER_THREADS to "8" on my machine because of lack of memory. When compiling C++ code, each compiler instance may take several Gigabytes, causing swapping and usually leading to OOM (even with a ridiculous amount of swap space).

I use my machine for lots of other things while building. All I do is just call "nice bitbake" so it basically gets only idle time. I put a CPU meter in the taskbar, other than the "100%" there I don't even notice what is happening as other applications all run without a glitch and get plenty of CPU attention.

The "hyperthreading" doesn't do much, the 6 fake cores only add a few percent extra performance (gcc tasks in general don't stall much). Linux will probably assign the big cores first, then the power-efficient cores, and the hyperthreading cores last. Chances are that if you run complex applications (like a browser), Linux will tend to move the compilation tasks to the power-efficient cores and run the complex stuff on the big cores.

I've used
BB_NUMBER_THREADS="12"
BB_NUMBER_PARSE_THREADS="12"
PARALLEL_MAKE="-j 12"
PARALLEL_MAKEINST="-j 12"

in attempt to limit the number of threads available to bitbake in the hopes of the scheduler putting everything on the High performance cores but I still see my entire machine maxed out even on the 8 e-cores

Is there something I am misunderstanding or is there another way to set the affinity of the bitbake environment to just the first 12 threads.

Google on "cpu affinity" will probably yield some suggestions.

My advice in general is "just don't touch it"...

I am probably overthinking this but it never hurts to ask

You sure are. Let the OS people worry about which taskt should be running where :)

Thanks

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#65590): https://lists.yoctoproject.org/g/yocto/message/65590
Mute This Topic: https://lists.yoctoproject.org/mt/113945507/3618446
Group Owner: [email protected]<mailto:[email protected]>
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]<mailto:[email protected]>]
-=-=-=-=-=-=-=-=-=-=-=-

--
Mike Looijmans
System Expert

TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands

T: +31 (0) 499 33 69 69
E: [email protected]<mailto:[email protected]>
W: www.topic.nl<http://www.topic.nl>

#4 lore raw

I hate to have asked an AI for this but with a few fixes I managed to find a way

Adding this to conf/local.conf

BB_ENV_PASSTHROUGH_ADDITIONS += "TASKSET"

And then building an image with

taskset -c 0-11 bitbake <image>

Allows you to force the cores to whatever you want, based on what Mike said, it's probably not helpful but nice to know

#5 lore raw
Quoted 5 lines · akarnil via lists.yoctoproject.org

I hate to have asked an AI for this but with a few fixes I managed to find a way

Adding this to conf/local.conf

BB_ENV_PASSTHROUGH_ADDITIONS += "TASKSET"

Can you ask this 'AI' to explain why the above is important, and what exactly is affected by the TASKSET variable being present in environment?

Alex

#6 lore raw

This is what it says (note that BB_ENV_EXTRAWHITE has been replaced with BB_ENV_PASSTHROUGH_ADDITIONS)

Quoted 37 lines

The line BB_ENV_EXTRAWHITE += "TASKSET" in a Yocto local.conf file is used to specify environment variables that should be preserved and passed to the BitBake tasks when they are executed. Here's a breakdown of its components:

*

*BB_ENV_EXTRAWHITE* : This is a BitBake variable that defines a list of environment variable names that should be exported to the environment of the tasks being executed. By default, BitBake only exports a limited set of environment variables to the tasks. This variable allows you to extend that list.

*

*+=* : This operator appends the specified value to the existing value of the variable. If BB_ENV_EXTRAWHITE already contains some variables, this will add "TASKSET" to the end of that list.

*

*"TASKSET"* : This is the name of the environment variable you want to preserve. In this context, it refers to the taskset command, which is used to set or retrieve the CPU affinity of a process.

Quoted 7 lines

By adding TASKSET to BB_ENV_EXTRAWHITE , you ensure that when BitBake runs tasks, it includes the TASKSET variable in the environment. This allows you to use taskset to control which CPU cores the BitBake tasks can run on, enabling you to manage CPU affinity effectively.

Comparing with the manual, https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-ref-variables.html#term-BB_ENV_PASSTHROUGH_ADDITIONS

It looks to match up, the only thing I can't figure out where TASKSET is defined or how it knows what to do with it

Alen

#7 lore raw
Quoted 6 lines · Alen Karnil via lists.yoctoproject.org

By adding TASKSET to BB_ENV_EXTRAWHITE, you ensure that when BitBake runs tasks, it includes the TASKSET variable in the environment. This allows you to use taskset to control which CPU cores the BitBake tasks can run on, enabling you to manage CPU affinity effectively.

Comparing with the manual, https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-ref-variables.html#term-BB_ENV_PASSTHROUGH_ADDITIONS

It looks to match up, the only thing I can't figure out where TASKSET is defined or how it knows what to do with it

So basically AI couldn't answer the actual question about the specific local.conf statement and instead gave a lecture about how passing through environment variables works in Yocto, that it learned from the manuals.

The reason you can't find where TASKSET is used is that we're almost certainly looking at an AI hallucination.

Alex

#8 lore raw

AI hallucination or not, it did work though, my CPU core usage was only on 0-11, there were doing idle not bitbake related tasks

taskset -c 0-11 bitbake welma-image-minimal

taskset -c 12-19 bitbake welma-image-minimal

This is building a fresh yocto image

Alen

#9 lore raw
Quoted 2 lines · Alen Karnil via lists.yoctoproject.org

AI hallucination or not, it did work though, my CPU core usage was only on 0-11, there were doing idle not bitbake related tasks taskset -c 0-11 bitbake welma-image-minimal

I suspect that is because of standard POSIX behavior. Child processes inherit CPU affinity.

Adding some mysterious "TASKSET" environment doesn't have any effect whatsoever, the AI is just making stuff up.

Signature · 10 lines
Mike Looijmans
System Expert

TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands

T: +31 (0) 499 33 69 69
E: [email protected]
W: www.topic.nl