I have RHEL 8 VM and trying to setup cgroup. Intention is to assign 2 CPU cores and 8GB memory to one process (starts with bash script). I am able to create cgroup, assign memory, but not CPU. And once I am able to fix the config, how can I assign specific process to this group ? In below output, last one is the process which I want to be associated with this group
Please advice, what I am missing.
[root@server-8-prod ~]# cgcreate -g cpu,memory:/cgroup_0
[root@server-8-prod ~]# cgset -r cpuset.cpus="0,1" cgroup_0
cgset: the group can't be modified
[root@server-8-prod ~]# cgset -r memory.limit_in_bytes=8192M cgroup_0
[root@server-8-prod ~]# systemctl status cgconfig
● cgconfig.service - Control Group configuration service
Loaded: loaded (/usr/lib/systemd/system/cgconfig.service; disabled; vendor preset: disabled)
Active: active (exited) since Mon 2024-07-22 12:50:22 PDT; 2s ago
Process: 3886 ExecStart=/usr/sbin/cgconfigparser -l /etc/cgconfig.conf -s 1664 (code=exited, status=0/SUCCESS)
Main PID: 3886 (code=exited, status=0/SUCCESS)
Jul 22 12:50:21 server-8-prod systemd[1]: Starting Control Group configuration service...
Jul 22 12:50:22 server-8-prod systemd[1]: Started Control Group configuration service.
[root@server-8-prod ~]#
[root@server-8-prod ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet systemd.unified_cgroup_hierarchy=1 systemd.unified_cgroup_hierarchy=0"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true
[root@server-8-prod ~]# cat /etc/cgconfig.conf | grep -v "#"
[root@server-8-prod ~]# ls -l /export/home/webadm4/snapshotreports-4.0/snapshotreports.sh
-rwxr-xr-x 1 webadm4 webadm4 2951 Jul 8 12:59 /export/home/webadm4/snapshotreports-4.0/snapshotreports.sh
[root@server-8-prod ~]# ps -ef | grep snapshot
webadm4 4811 1 6 13:23 pts/0 00:00:00 /usr/bin/java -Dsnapshotreportsinstance=snapshotreports-4.0 -Xms1G -Xmx4G --add-opens java.base/java.lang=ALL-UNNAMED -Dlog.dir=/export/home/webadm4/snapshotreports-4.0/logs -jar /export/home/webadm4/snapshotreports-4.0/snapshotreports-4.0.0-SNAPSHOT.jar --logging.config=logback-spring.xml
root 4840 3758 0 13:24 pts/0 00:00:00 grep --color=auto snapshot
[root@server-8-prod ~]#
Thanks