| | 519 | * https://www.kernel.org/doc/Documentation/cgroups/cgroups.txt |
| | 520 | > Each cgroup is represented by a directory in the cgroup file system |
| | 521 | > containing the following files describing that cgroup: |
| | 522 | > |
| | 523 | > - tasks: list of tasks (by pid) attached to that cgroup. This list |
| | 524 | > is not guaranteed to be sorted. Writing a thread id into this file |
| | 525 | > moves the thread into this cgroup. |
| | 526 | > - cgroup.procs: list of tgids in the cgroup. This list is not |
| | 527 | > guaranteed to be sorted or free of duplicate tgids, and userspace |
| | 528 | > should sort/uniquify the list if this property is required. |
| | 529 | > Writing a thread group id into this file moves all threads in that |
| | 530 | > group into this cgroup. |
| | 531 | > - notify_on_release flag: run the release agent on exit? |
| | 532 | > - release_agent: the path to use for release notifications (this file |
| | 533 | > exists in the top cgroup only) |
| | 534 | |
| | 716 | |
| | 717 | ==== cgroup-lite ==== |
| | 718 | * Ubuntu 12.04 with {{{cgroup-lite}}} |
| | 719 | * aptitude install時に-Rとしない場合、{{{cgroup-lite}}}がRecommendsからインストールされる |
| | 720 | * /bin/cgroups-mount |
| | 721 | {{{ |
| | 722 | mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup |
| | 723 | }}} |
| | 724 | * $ sudo lxc-cgroup -n lxc-test tasks |
| | 725 | {{{ |
| | 726 | lxc-cgroup: cgroup is not mounted |
| | 727 | lxc-cgroup: failed to retrieve value of 'tasks' for 'lxc-test' |
| | 728 | }}} |
| | 729 | |
| | 730 | * $ ls -1F /sys/fs/cgroup/ |
| | 731 | {{{ |
| | 732 | blkio/ |
| | 733 | cpu/ |
| | 734 | cpuacct/ |
| | 735 | cpuset/ |
| | 736 | devices/ |
| | 737 | freezer/ |
| | 738 | memory/ |
| | 739 | perf_event/ |
| | 740 | }}} |
| | 741 | * $ find /sys/fs/cgroup/ | grep lxc-test/tasks | xargs wc |
| | 742 | {{{ |
| | 743 | 17 17 102 /sys/fs/cgroup/perf_event/lxc/lxc-test/tasks |
| | 744 | 17 17 102 /sys/fs/cgroup/blkio/lxc/lxc-test/tasks |
| | 745 | 17 17 102 /sys/fs/cgroup/freezer/lxc/lxc-test/tasks |
| | 746 | 17 17 102 /sys/fs/cgroup/devices/lxc/lxc-test/tasks |
| | 747 | 17 17 102 /sys/fs/cgroup/memory/lxc/lxc-test/tasks |
| | 748 | 17 17 102 /sys/fs/cgroup/cpuacct/lxc/lxc-test/tasks |
| | 749 | 17 17 102 /sys/fs/cgroup/cpu/lxc/lxc-test/tasks |
| | 750 | 17 17 102 /sys/fs/cgroup/cpuset/lxc/lxc-test/tasks |
| | 751 | }}} |
| | 752 | * $ cat /sys/fs/cgroup/perf_event/lxc/lxc-test/tasks |
| | 753 | {{{ |
| | 754 | 17390 |
| | 755 | 17539 |
| | 756 | 17556 |
| | 757 | 17560 |
| | 758 | 17562 |
| | 759 | 17567 |
| | 760 | 17568 |
| | 761 | 17570 |
| | 762 | 17599 |
| | 763 | 17621 |
| | 764 | 17647 |
| | 765 | 17651 |
| | 766 | 17654 |
| | 767 | 17659 |
| | 768 | 17678 |
| | 769 | 17681 |
| | 770 | 17829 |
| | 771 | }}} |
| | 772 | |
| | 773 | ==== cgroup-bin ==== |
| | 774 | * Ubuntu 12.04 with {{{cgroup-bin}}} |
| | 775 | * cgroup-binとcgroup-liteはコンフリクトする |
| | 776 | * /etc/init/cgconfig.conf |
| | 777 | {{{ |
| | 778 | mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroups /sys/fs/cgroup |
| | 779 | }}} |
| | 780 | * $ sudo lxc-cgroup -n lxc-test tasks |
| | 781 | {{{ |
| | 782 | lxc-cgroup: cgroup is not mounted |
| | 783 | lxc-cgroup: failed to retrieve value of 'tasks' for 'lxc-test' |
| | 784 | }}} |
| | 785 | |
| | 786 | * $ ls -1F /sys/fs/cgroup/ |
| | 787 | {{{ |
| | 788 | cpu/ |
| | 789 | cpuacct/ |
| | 790 | devices/ |
| | 791 | freezer/ |
| | 792 | memory/ |
| | 793 | }}} |
| | 794 | * $ find /sys/fs/cgroup/ | grep lxc-test/tasks | xargs wc |
| | 795 | {{{ |
| | 796 | 16 16 80 /sys/fs/cgroup/freezer/sysdefault/lxc/lxc-test/tasks |
| | 797 | 16 16 80 /sys/fs/cgroup/memory/sysdefault/lxc/lxc-test/tasks |
| | 798 | 16 16 80 /sys/fs/cgroup/devices/sysdefault/lxc/lxc-test/tasks |
| | 799 | 16 16 80 /sys/fs/cgroup/cpuacct/sysdefault/lxc/lxc-test/tasks |
| | 800 | 16 16 80 /sys/fs/cgroup/cpu/sysdefault/lxc/lxc-test/tasks |
| | 801 | }}} |
| | 802 | * $ cat /sys/fs/cgroup/freezer/sysdefault/lxc/lxc-test/tasks |
| | 803 | {{{ |
| | 804 | 1296 |
| | 805 | 1390 |
| | 806 | 1434 |
| | 807 | 1461 |
| | 808 | 1470 |
| | 809 | 1471 |
| | 810 | 1473 |
| | 811 | 1474 |
| | 812 | 1502 |
| | 813 | 1524 |
| | 814 | 1552 |
| | 815 | 1562 |
| | 816 | 1563 |
| | 817 | 1566 |
| | 818 | 1580 |
| | 819 | 1582 |
| | 820 | }}} |