慢慢欣赏linux cgroup

创建cpu的cgroup的过程

root@cliffr zl]# cat /proc/cpuinfo 
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 55
model name      : Intel(R) Atom(TM) CPU  Z3735F @ 1.33GHz
stepping        : 8
cpu MHz         : 1332.696
cache size      : 1024 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 4
apicid          : 0
initial apicid  : 0
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht nx rdtscp constant_tsc xtopology nonstop_tsc pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 movbe popcnt aes rdrand lahf_lm 3dnowprefetch
bogomips        : 2665.39
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 55
model name      : Intel(R) Atom(TM) CPU  Z3735F @ 1.33GHz
stepping        : 8
cpu MHz         : 1332.696
cache size      : 1024 KB
physical id     : 0
siblings        : 4
core id         : 1
cpu cores       : 4
apicid          : 1
initial apicid  : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht nx rdtscp constant_tsc xtopology nonstop_tsc pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 movbe popcnt aes rdrand lahf_lm 3dnowprefetch
bogomips        : 2665.39
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

processor       : 2
vendor_id       : GenuineIntel
cpu family      : 6
model           : 55
model name      : Intel(R) Atom(TM) CPU  Z3735F @ 1.33GHz
stepping        : 8
cpu MHz         : 1332.696
cache size      : 1024 KB
physical id     : 0
siblings        : 4
core id         : 2
cpu cores       : 4
apicid          : 2
initial apicid  : 2
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht nx rdtscp constant_tsc xtopology nonstop_tsc pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 movbe popcnt aes rdrand lahf_lm 3dnowprefetch
bogomips        : 2665.39
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

processor       : 3
vendor_id       : GenuineIntel
cpu family      : 6
model           : 55
model name      : Intel(R) Atom(TM) CPU  Z3735F @ 1.33GHz
stepping        : 8
cpu MHz         : 1332.696
cache size      : 1024 KB
physical id     : 0
siblings        : 4
core id         : 3
cpu cores       : 4
apicid          : 3
initial apicid  : 3
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht nx rdtscp constant_tsc xtopology nonstop_tsc pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 movbe popcnt aes rdrand lahf_lm 3dnowprefetch
bogomips        : 2665.39
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

[root@cliffr zl]# 
[root@cliffr zl]# mkdir /dev/cgroup_cpu

[root@cliffr zl]# mount -t cgroup -o cpuset cpuset /dev/cgroup_cpu/
[root@cliffr zl]# ls /dev/cgroup_cpu/
cgroup.event_control  cpuset.cpus           cpuset.memory_migrate           cpuset.memory_spread_page  cpuset.sched_load_balance        notify_on_release
cgroup.procs          cpuset.mem_exclusive  cpuset.memory_pressure          cpuset.memory_spread_slab  cpuset.sched_relax_domain_level  release_agent
cpuset.cpu_exclusive  cpuset.mem_hardwall   cpuset.memory_pressure_enabled  cpuset.mems                libvirt                          tasks
[root@cliffr zl]# cd /dev/cgroup_cpu/
[root@cliffr cgroup_cpu]# mkdir Charlie
[root@cliffr cgroup_cpu]# cd Charlie
[root@cliffr Charlie]# ls
cgroup.event_control  cpuset.cpus           cpuset.memory_migrate      cpuset.memory_spread_slab  cpuset.sched_relax_domain_level
cgroup.procs          cpuset.mem_exclusive  cpuset.memory_pressure     cpuset.mems                notify_on_release
cpuset.cpu_exclusive  cpuset.mem_hardwall   cpuset.memory_spread_page  cpuset.sched_load_balance  tasks
[root@cliffr Charlie]# /bin/echo 2-3 > cpuset.cpus
[root@cliffr Charlie]# cat cpuset.cpus 
2-3
[root@cliffr Charlie]# cat cpuset.mems 

[root@cliffr Charlie]# echo 1 > cpuset.mems
bash: echo: write error: Numerical result out of range
[root@cliffr Charlie]# echo 0 > cpuset.mems
[root@cliffr Charlie]# cat cpuset.mems 
0
[root@cliffr Charlie]# echo $$ > tasks
[root@cliffr Charlie]# cat tasks 
2383
2407
[root@cliffr Charlie]# ps
  PID TTY          TIME CMD
 2376 pts/0    00:00:00 su
 2383 pts/0    00:00:00 bash
 2408 pts/0    00:00:00 ps
[root@cliffr Charlie]# 

 

Linux Cgroup浅析
https://zhuanlan.zhihu.com/p/102372680

Linux cgroup机制分析之框架分析
https://blog.csdn.net/ctoday/article/details/20838587

Linux cgroup机制分析之框架分析
http://blog.chinaunix.net/uid-20543183-id-1930840.html

Cgroup框架分析
https://blog.csdn.net/zhangyifei216/article/details/49491549

Android/Linux下CGroup框架分析及其使用
https://www.cnblogs.com/arnoldlu/p/6208443.html

cgroup框架结构
http://blog.chinaunix.net/uid-30126070-id-5065454.html

Docker背后的内核知识——cgroups资源限制
http://www.sel.zju.edu.cn/?p=573

cgroup中的cgroup_subsys[]数组解析
https://blog.csdn.net/wennuanddianbo/article/details/71244276

Linux Cgroups详解  好文
https://www.cnblogs.com/lisperl/archive/2012/04/17/2453838.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值