]> git.proxmox.com Git - mirror_lxcfs.git/commit
sysfs: don't mask cpus in /sys/devices/system/cpu
authorTycho Andersen <tycho@tycho.pizza>
Thu, 27 Oct 2022 16:23:08 +0000 (10:23 -0600)
committerTycho Andersen <tycho@tycho.pizza>
Wed, 4 Jan 2023 16:32:19 +0000 (09:32 -0700)
commit0a0948b62d9d00729fee8fb17d628b5adab11b09
tree2ab55ccc159636cbcef222b259ae4794fc42c0f7
parent6ea5370b8c4fde3ae5fecad9d7af9ddfd173a6b6
sysfs: don't mask cpus in /sys/devices/system/cpu

The kernel does not mask the cpu%d dirs when they are offlined:

(root) /sys/devices/system/cpu # cat online
0-7
(root) /sys/devices/system/cpu # chcpu -d 4
CPU 4 disabled
(root) /sys/devices/system/cpu # cat online
0-3,5-7
(root) /sys/devices/system/cpu # cat offline
4
(root) /sys/devices/system/cpu # ls -al
total 0
drwxr-xr-x 16 root root    0 Oct 25 20:42 .
drwxr-xr-x 10 root root    0 Oct 25 20:42 ..
drwxr-xr-x  7 root root    0 Oct 25 20:42 cpu0
drwxr-xr-x  7 root root    0 Oct 25 20:42 cpu1
drwxr-xr-x  7 root root    0 Oct 25 20:42 cpu2
drwxr-xr-x  7 root root    0 Oct 25 20:42 cpu3
drwxr-xr-x  5 root root    0 Oct 25 20:42 cpu4
drwxr-xr-x  7 root root    0 Oct 25 20:42 cpu5
drwxr-xr-x  7 root root    0 Oct 25 20:42 cpu6
drwxr-xr-x  7 root root    0 Oct 25 20:42 cpu7
drwxr-xr-x  2 root root    0 Oct 25 20:43 cpufreq
drwxr-xr-x  2 root root    0 Oct 26 15:19 cpuidle
drwxr-xr-x  2 root root    0 Oct 26 15:19 hotplug
-r--r--r--  1 root root 4096 Oct 25 20:42 isolated
-r--r--r--  1 root root 4096 Oct 25 20:43 kernel_max
-r--r--r--  1 root root 4096 Oct 26 15:19 modalias
-r--r--r--  1 root root 4096 Oct 26 15:19 offline
-r--r--r--  1 root root 4096 Oct 25 20:42 online
-r--r--r--  1 root root 4096 Oct 25 20:43 possible
drwxr-xr-x  2 root root    0 Oct 26 15:19 power
-r--r--r--  1 root root 4096 Oct 25 20:43 present
drwxr-xr-x  2 root root    0 Oct 26 15:19 smt
-rw-r--r--  1 root root 4096 Oct 25 20:42 uevent
drwxr-xr-x  2 root root    0 Oct 26 15:19 vulnerabilities

let's not mask them in lxcfs either. In particular, we have observed this
causing problems with some JVMs' implementation of
Runtime.getRuntime().availableProcessors().

This is a bit of a strange patch: it seems masking this dir was always
incorrect, so we could go back to just not offering it as an lxcfs
endpoint, and having people use sysfs' implementation directly. But maybe
people are expecting it now, so I've left it as a proxy. Perhaps a more
appropriate patch is to just delete it entirely and add an API extension
note?

Signed-off-by: Tycho Andersen <tycho@tycho.pizza>
README.md
src/sysfs_fuse.c
tests/main.sh.in
tests/meson.build
tests/test_sysfs.in [deleted file]