1) Why cgroup is showing more number of tasks than actual number of tasks.?
Ex :
[root@localhost proc]# ps -aux | wc -l
421
[root@localhost proc]# cat /sys/fs/cgroup/memory/tasks | wc -l
539
2) Why cgroup is showing more memory usage then actual memory usage?
Ex :
[root@localhost memory]# free -h
total used free shared buff/cache available
Mem: 11G 425M 9.4G 38M 1.7G 10G
Swap: 2.0G 193M 1.8G
[root@localhost memory]# cat /sys/fs/cgroup/memory/memory.usage_in_bytes
1596362752
Above you can see free is showing used memory as 425M and cgroups is showing around 1.4GB?
Please note that there is only 1 default cgroup, no other cgroups are created
3) How to calculate correct/proper memory utilization for cgroups?