全部博文(385)
分类: LINUX
2012-11-15 18:36:47
isolcpus= [KNL,SMP] Isolate CPUs from the general scheduler.
Format:
or
(must be a positive range in ascending order)
or a mixture
This option can be used to specify one or more CPUs
to isolate from the general SMP balancing and scheduling
algorithms. You can move a process onto or off an
"isolated" CPU via the CPU affinity syscalls or cpuset.
"number of CPUs in system - 1".
This option is the preferred way to isolate CPUs. The
alternative -- manually setting the CPU mask of all
tasks in the system -- can cause problems and
suboptimal load balancer performance.
isolcpus=8-12
也就是说我们在启动系统时将默认不使用CPU8 cpu9 cpu10 ,注意这里说的默认不使用并不是绝对的,操作系统仍然可以指定使用哪个CPU.
对于用户而言可以通过taskset来做到这点.
taskset [options] -p [mask] pid
查看进程在哪个cpu(逻辑cpu核)上跑:
sles11sp2:/usr/src/linux/Documentation # ps -eo pid,args:50,psr
PID COMMAND PSR
1 init [5] 3
2 [kthreadd] 6
3 [ksoftirqd/0] 0
4 [kworker/0:0] 0
5 [kworker/u:0] 6
6 [migration/0] 0
7 [watchdog/0] 0
8 [migration/1] 1
9 [kworker/1:0] 1
10 [ksoftirqd/1] 1
11 [kworker/0:1] 0
12 [watchdog/1] 1
13 [migration/2] 2
14 [kworker/2:0] 2
15 [ksoftirqd/2] 2
16 [watchdog/2] 2
17 [migration/3] 3
18 [kworker/3:0] 3
19 [ksoftirqd/3] 3
20 [watchdog/3] 3
21 [migration/4] 4
22 [kworker/4:0] 4
23 [ksoftirqd/4] 4
24 [watchdog/4] 4
25 [migration/5] 5
26 [kworker/5:0] 5
27 [ksoftirqd/5] 5
28 [watchdog/5] 5
29 [migration/6] 6
30 [kworker/6:0] 6
31 [ksoftirqd/6] 6
32 [watchdog/6] 6
33 [migration/7] 7
34 [kworker/7:0] 7
35 [ksoftirqd/7] 7
36 [watchdog/7] 7
37 [migration/8] 8
38 [kworker/8:0] 8
39 [ksoftirqd/8] 8
40 [watchdog/8] 8
41 [migration/9] 9
42 [kworker/9:0] 9
43 [ksoftirqd/9] 9
44 [watchdog/9] 9
45 [migration/10] 10
46 [kworker/10:0] 10
47 [ksoftirqd/10] 10
48 [watchdog/10] 10
49 [migration/11] 11
50 [kworker/11:0] 11
51 [ksoftirqd/11] 11
52 [watchdog/11] 11
53 [migration/12] 12
54 [kworker/12:0] 12
55 [ksoftirqd/12] 12
56 [watchdog/12] 12
57 [migration/13] 13
58 [kworker/13:0] 13
59 [ksoftirqd/13] 13
60 [watchdog/13] 13
61 [migration/14] 14
62 [kworker/14:0] 14
63 [ksoftirqd/14] 14
64 [watchdog/14] 14
65 [migration/15] 15
66 [kworker/15:0] 15
67 [ksoftirqd/15] 15
68 [watchdog/15] 15
69 [cpuset] 3
70 [khelper] 3
71 [netns] 3
72 [sync_supers] 4
73 [bdi-default] 3
74 [kintegrityd] 3
75 [kblockd] 3
76 [md] 3
77 [kworker/5:1] 5
78 [kworker/13:1] 13
80 [khungtaskd] 3
81 [kswapd0] 0
82 [kswapd1] 3
83 [ksmd] 3
84 [khugepaged] 5
85 [fsnotify_mark] 3
86 [kworker/3:1] 3
87 [crypto] 3
89 [kthrotld] 3
90 [kworker/15:1] 15
91 [kpsmoused] 3
93 [kworker/2:2] 2
95 [kworker/1:1] 1
118 [kworker/4:1] 4
147 [mpt_poll_0] 3
148 [mpt/0] 3
149 [kworker/7:2] 7
150 [kworker/6:1] 6
151 [kworker/8:1] 8
152 [kworker/9:1] 9
153 [kworker/10:1] 10
154 [kworker/11:1] 11
155 [kworker/12:1] 12
156 [kworker/14:1] 14
157 [scsi_eh_0] 3
158 [kworker/u:1] 3
166 [ata_sff] 3
171 [scsi_eh_1] 1
172 [scsi_eh_2] 3
203 [kmpath_rdacd] 3
382 [khubd] 2
385 [scsi_eh_3] 13
419 [qla2xxx_3_dpc] 0
420 [scsi_wq_3] 0
490 [kjournald] 5
496 [flush-8:0] 6
565 /sbin/udevd --daemon 13
750 [edac-poller] 0
759 [kvm-irqfd-clean] 3
895 [kauditd] 3
1094 [kjournald] 3
1600 /sbin/acpid 0
1615 /bin/dbus-daemon --system 6
1633 /sbin/syslog-ng 5
1636 /sbin/klogd -c 1 -x 2
1920 /usr/sbin/hald --daemon=yes 14
1923 /usr/sbin/console-kit-daemon 13
1924 hald-runner 0
2019 hald-addon-input: Listening on /dev/input/event1 4
2051 hald-addon-acpi: listening on acpid socket /var/ru 5
4457 /sbin/dhcpcd --netconfig -L -E -c /etc/sysconfig/n 2
5011 /sbin/auditd -s disable 4
5013 /sbin/audispd 1
5045 /sbin/haveged -w 1024 -v 1 4
5046 /sbin/rpcbind 4
5100 /sbin/udevd --daemon 4
5101 /sbin/udevd --daemon 14
5170 /usr/sbin/irqbalance 4
5185 /usr/sbin/mcelog --daemon --config-file /etc/mcelo 2
6204 /usr/sbin/sshd -o PidFile=/var/run/sshd.init.pid 2
6224 /usr/sbin/nscd 14
6259 /usr/sbin/cupsd 1
6285 /usr/sbin/libvirtd -d -l 2
6370 /usr/lib/postfix/master 6
6400 pickup -l -t fifo -u 14
6401 qmgr -l -t fifo -u 3
6422 /usr/sbin/gdm 3
6435 /usr/lib/gdm/gdm-simple-slave --display-id /org/gn 4
6445 /usr/bin/X :0 -br -verbose -auth /var/run/gdm/auth 6
6446 /usr/sbin/cron 13
6468 /usr/sbin/smartd 13
6486 /usr/sbin/xinetd -pidfile /var/run/xinetd.init.pid 0
6501 /sbin/mingetty --noclear tty1 7
6502 /sbin/mingetty tty2 2
6503 /sbin/mingetty tty3 14
6504 /sbin/mingetty tty4 4
6505 /sbin/mingetty tty5 6
6506 /sbin/mingetty tty6 5
6660 /usr/bin/dbus-launch --exit-with-session 1
6663 /bin/dbus-daemon --fork --print-pid 5 --print-addr 6
6664 /usr/bin/gnome-session --autostart=/usr/share/gdm/ 4
6669 /usr/lib/GConf/2/gconfd-2 4
6673 /usr/lib/at-spi/at-spi-registryd 6
6677 /usr/lib/gnome-settings-daemon/gnome-settings-daem 6
6679 /usr/lib/bonobo/bonobo-activation-server --ac-acti 5
6683 gnome-power-manager 4
6687 /usr/lib64/gvfs/gvfsd 0
6688 metacity 14
6689 /usr/lib/gdm/gdm-simple-greeter 4
6695 /usr/bin/pulseaudio --start --log-target=syslog 3
6816 sshd: root@pts/0 3
6838 -bash 4
6924 ./while1 1
6925 ./while1 0
6926 ./while1 2
6927 ./while1 7
7214 /usr/lib/gdm/gdm-session-worker 6
7224 ps -eo pid,args:50,psr 5
我们这里用一个简单的循环程序测试一下:
#include
int
main ()
{
while(1){
}
return 0;
}
while1 &
while1 &
while1 &
while1 &
sles11sp2:/opt # ps -o pid,psr,comm 6924 6925 6926 6927
PID PSR COMMAND
6924 1 while1
6925 5 while1
6926 2 while1
6927 7 while1