Excellent work Michael, good to know how it's done.

Though, I have a suspicion that when /proc/meminfo and /proc/cpuinfo don't 
match other constraints some applications might make incorrect decisions.  No 
facts, just a gut feeling.

Lonnie


> On May 24, 2020, at 5:10 PM, Michael Keuter <li...@mksolutions.info> wrote:
> 
> 
> 
>> Am 24.05.2020 um 23:54 schrieb Michael Keuter <li...@mksolutions.info>:
>> 
>> 
>> 
>>> Am 24.05.2020 um 23:38 schrieb Michael Keuter <li...@mksolutions.info>:
>>> 
>>> 
>>> 
>>>> Am 24.05.2020 um 23:24 schrieb Lonnie Abelbeck <li...@lonnie.abelbeck.com>:
>>>> 
>>>> 
>>>> 
>>>>> On May 24, 2020, at 3:49 PM, Michael Keuter <li...@mksolutions.info> 
>>>>> wrote:
>>>>> 
>>>>> Try running the "yes" stresstest in the container, with the above 
>>>>> limitations.
>>>> 
>>>> If I define lxc.cgroup.cpuset.cpus to 1, or 2 or 3, the "yes" stress-test 
>>>> [1] only uses one core.
>>>> 
>>>> Setting lxc.cgroup.cpuset.cpus=4 the container does not start.
>>>> 
>>>> Not setting lxc.cgroup.cpuset.cpus all 4 cores are used.
>>>> 
>>>> Lonnie
>>>> 
>>>> [1]
>>>> (start test)
>>>> # for x in 1 2 3 4; do ( yes >/dev/null & ); done
>>>> 
>>>> (stop test)
>>>> # killall yes
>>> 
>>> ----
>>> From the man page:
>>> 
>>> lxc-cgroup -n foo cpuset.cpus "0,3"
>>> assign the processors 0 and 3 to the container.
>>> ----
>>> 
>>> I guess you define which CPU cores are allowed to use (0-3), that's why 4 
>>> does not work :-).
>>> 
>>> lxc.cgroup.cpuset.cpus=0,3  (maybe in quotes, should use core 1 and 4)
>> 
>> Yup, this uses CPU 2 + 4 (core 0 + 3), you define the actual cores NOT the 
>> count!
>> 
>> lxc.cgroup.cpuset.cpus = 1,3
> 
> The RAM limit seems also be working fine. I set this in the container config:
> 
> lxc.cgroup.memory.limit_in_bytes = 256M
> 
> For the test you need to install the "pv" command to see the actual RAM value:
> 
> ----
> root@deb10:# dd if=/dev/zero bs=1024 | pv -b -B 1024 | dd of=/dev/shm/fill 
> bs=1024
> 
> dd: error writing '/dev/shm/fill': Cannot allocate memory
> 240MiB
> 246721+0 records in
> 246720+0 records out
> 252641280 bytes (253 MB, 241 MiB) copied, 4.63373 s, 54.5 MB/s
> ----
> 
> Sometimes the container crashes at the end of that test.
> 
> Michael
> 
> http://www.mksolutions.info
> 
> 
> 
> 
> 
> _______________________________________________
> Astlinux-users mailing list
> Astlinux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/astlinux-users
> 
> Donations to support AstLinux are graciously accepted via PayPal to 
> pay...@krisk.org.



_______________________________________________
Astlinux-users mailing list
Astlinux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/astlinux-users

Donations to support AstLinux are graciously accepted via PayPal to 
pay...@krisk.org.

Reply via email to