Skip to content

cset shield fails if non-trailing CPU cores are offline #37

@apighin

Description

@apighin

(Logfile attached.)

root@localhost:~# cset set
cset: 
         Name       CPUs-X    MEMs-X Tasks Subs Path
 ------------ ---------- - ------- - ----- ---- ----------
         root       0-15 y       0 y   224    0 /

# Take "last" core offline
root@localhost:~# echo 0 > /sys/devices/system/cpu/cpu15/online 

root@localhost:~# cset shield -c2-5
cset: --> activating shielding:
cset: moving 37 tasks from root into system cpuset...
[==================================================]%
cset: "system" cpuset of CPUSPEC(0-1,6-14) with 37 tasks running
cset: "user" cpuset of CPUSPEC(2-5) with 0 tasks running

# cset shield succeeds
root@localhost:~# cset set
cset: 
         Name       CPUs-X    MEMs-X Tasks Subs Path
 ------------ ---------- - ------- - ----- ---- ----------
         root       0-14 y       0 y   187    2 /
         user        2-5 y       0 n     0    0 /user
       system   0-1,6-14 y       0 n    37    0 /system

root@localhost:~# cset shield -r   
cset: --> deactivating/reseting shielding
cset: moving 0 tasks from "/user" user set to root set...
cset: moving 37 tasks from "/system" system set to root set...
[==================================================]%
cset: deleting "/user" and "/system" sets
cset: done

root@localhost:~# cset set
cset: 
         Name       CPUs-X    MEMs-X Tasks Subs Path
 ------------ ---------- - ------- - ----- ---- ----------
         root       0-14 y       0 y   225    0 /

# Restore "last" core
root@localhost:~# echo 1 > /sys/devices/system/cpu/cpu15/online 
# Take second last core offline
root@localhost:~# echo 0 > /sys/devices/system/cpu/cpu14/online 

root@localhost:~# cset set
cset: 
         Name       CPUs-X    MEMs-X Tasks Subs Path
 ------------ ---------- - ------- - ----- ---- ----------
         root    0-13,15 y       0 y   225    0 /

# cset shield fails
root@localhost:~# cset -l /tmp/bad_shield shield -c2-5
cset: --> failed to create shield, hint: do other cpusets exist?
cset: **> [Errno 22] Invalid argument

# HOWEVER! I can manually create a non-contiguous set (not using "shield")
[bad_shield.txt](https://github.com/lpechacek/cpuset/files/5431496/bad_shield.txt)


root@localhost:~# cset set
cset: 
         Name       CPUs-X    MEMs-X Tasks Subs Path
 ------------ ---------- - ------- - ----- ---- ----------
         root    0-13,15 y       0 y   212    0 /

root@localhost:~# cset set -c2-5 --cpu_exclusive user
cset: --> created cpuset "user"
root@localhost:~# cset set
cset: 
         Name       CPUs-X    MEMs-X Tasks Subs Path
 ------------ ---------- - ------- - ----- ---- ----------
         root    0-13,15 y       0 y   212    1 /
         user        2-5 y       0 n     0    0 /user

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions