I am relatively new to lxc/lxd. I am running an Ubuntu16.04 dedicated server with lxc/lxd installed from default xenial-updates repository. Lxc/lxd version 2.0.11 as said in the title.
My server runs on an intel i7-4790K quad core cpu giving me 8 logical cpu’s to use. I want to isolate a certain logical core for a specific container without the need to set cpu affinity for every task on on the server. A logical approach on the first look seems to be, to use the ‘isolcpus’ kernel parameter, to remove the desired core from load balancing and then pin the container via 'lxc config set limits.cpu ’ to the before isolated cpu.
This doesn’t seem to work however. After isolating half my logical cores from load balancing (core’s 4,5,6,7) I see only 0,1,2 and 3 being used in htop. This itself wasn’t really surprising, even though, I assumed kernel threads would still run on the isolated cores, which they don’t in htop, but I am also not able to assign the isolated cores via limits.cpu to the desired container. After using limits.cpu the container processes run on core’s 0,1,2 and 3. It seems like 4,5,6 and 7 are completely ignored by the system now (Just by judging on htop output).
What am I doing wrong? 2.0.11 release notes mention support for isolcpus kernel parameter. I assumed pinning isolated cpu’s via limits.cpu would work therefore. As far as I understand right now, limits.cpu uses cpuset from cgrups to set core affinity. What I could find on google so far seems to support using isolcpus parameter together with cpuset. Could someone maybe give me a practical example of how reserving a logical cpu core for a container should look like?
Cheers in advance.
P.S: This is my first post in this forum. I didn’t really read about posting rules I admit. If I did broke any posting regulations, I do apologize.
pps: command line for cpu isolation in /etc/default/grub = GRUB_CMDLINE_LINUX_DEFAULT="quiet isolcpus=4,5,6,7"
Yes, I did run ‘update-grub’ with sudo after editing the file.
Command used to pin the container onto the last logical core = lxc config set prbf2-main limits.cpu 7-7
prbf2-main is the name of the container I want to pin to core nr.7.