3

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?

1

1) A multi-threaded process has a single line in ps aux output, when each thread is a task. Compare ps -auxH | wc -l

  • Yes, Its correct, I have a question, i have created a thread and when i did "ps -aux" i can see lines for both the thread (Main process and its thread), So does it mean that only kernel's thread is not included in "ps -aux"? – Chirag Feb 15 '16 at 4:12
  • And Yes Thank You :) I wish you could help in 3rd question, i have to calculate cgroup's memory status and i am not sure how to achieve that as cgroups's memory is different than "free -h". – Chirag Feb 15 '16 at 4:13
  • 1
    I don't understand what you're calling "kernel thread". ps -aux lists only the main thread of each process, ps -auxH lists all threads. – L. Levrel Feb 16 '16 at 16:08
  • As for your 3rd question, I'm sorry, I know very little about cgroups. (Maybe is shared memory counted several times? That'd be weird though.) – L. Levrel Feb 16 '16 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.