Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seeing incorrect offline and online CPUs #1470

Open
capriciousduck opened this issue May 3, 2024 · 5 comments
Open

Seeing incorrect offline and online CPUs #1470

capriciousduck opened this issue May 3, 2024 · 5 comments
Labels
bug 🐛 Something isn't working Containers 📦 Light-weight virtualization suites Linux 🐧 Linux related issues

Comments

@capriciousduck
Copy link

Hey

I am running htop in an LXC container that uses the Ubuntu Noble image (Ubuntu 24.04). This time, unlike before, htop shows the "offline" CPUs as well.

This is what I expect:

For example, if I allocate 5 CPUs only to the LXC container, htop should show the 5 vCPUs.

This is what I see:

I see the 5 "online" CPUs and all the other CPUs (of the host) are shown as "offline". Often times, more than 5 CPUs show as online. However, top shows the correct amount of CPUs always.

As you can see from the image below more than 5 CPUs are shown as online

Screenshot from 2024-05-03 18-20-05

This is the output of top:

Screenshot from 2024-05-03 18-21-08

Some other info you may find useful

htop version: 3.3.0
os: Ubuntu Noble (Ubuntu 24.04)
host kernel version: 6.8.0-31-generic

@fasterit
Copy link
Member

fasterit commented May 3, 2024

Can you add the PROCESSOR column to see on which CPU your processes are executed?
May be LXC uses more than 5 cores by shuffling load around?

@capriciousduck
Copy link
Author

The CPU cores is fixed (i.e will be 5 at all times) but yes the load may run on other cores sometimes but lxcfs will abstract this. In the past, I did not see this issue (on Jammy, Focal, etc,).

image

Let me know if you need more information.

@capriciousduck
Copy link
Author

This happens even in a KVM machine (also has 5 CPUs). I think this is happening only on Ubuntu Noble as I don't see this issue happening on LXC Jammy container which is also running on the same physical host.

@BenBE BenBE added bug 🐛 Something isn't working Linux 🐧 Linux related issues labels May 6, 2024
@BenBE BenBE added the Containers 📦 Light-weight virtualization suites label Sep 17, 2024
@589290
Copy link

589290 commented Oct 10, 2024

Would adding an option to htop that allows you to "hide offline cpus" be a solution?

@BenBE
Copy link
Member

BenBE commented Oct 11, 2024

We discussed this internally a while back and while for static offline CPU assignments like within containers this may be of help, it causes a bit of flicker for bare metal systems when their host CPU briefly disables cores and re-enables others. Also, due to the way the CPU meters are currently handled, this would need many changes related to counting header lines needed and actually rendering the correct CPUs for each of the meters. TL;DR: Not worth the effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working Containers 📦 Light-weight virtualization suites Linux 🐧 Linux related issues
Projects
None yet
Development

No branches or pull requests

4 participants