Question on using limits.cpu and limits.cpu.allowance together (at the same time)

Hello,

doing an incus test setup, and I have a question.
Was not able to find a clear answer until now.

I will try to make the question using a real example:

Consider a host with 16 cores, 32 CPU threads.

When using at the same time those 2 options below for one container:
limits.cpu.allowance=50ms/10ms
limits.cpu: “16”

I understand that incus will select 16 CPUs for this container to use and the container load will be distributed on those 16 CPUs. So far so good.

But is the (50/10) applied on 32 or on 16?

The important question is: How many of the total 32 CPU host threads will this container utilize at maximum load?

Thank you.

The two concepts are separate within Linux, 50ms/10ms gives you effectively 5 full threads worth of scheduler time while the cpuset limit (16) has Incus restrict you to a specific set of 16 threads.

So the result will be 5 CPUs worth of CPU time spread over a random set of 16 threads.

2 Likes

Thank you for your clear and immediate answer.

1 Like