1 |
Peter Humphrey <prh@××××××××××.uk> posted |
2 |
200705201511.52195.prh@××××××××××.uk, excerpted below, on Sun, 20 May |
3 |
2007 15:11:52 +0100: |
4 |
|
5 |
> This is turning into a bad month :-( |
6 |
|
7 |
They happen. =8^( |
8 |
|
9 |
> I'm running BOINC clients on this box, and the kernel seems unable to |
10 |
> schedule them properly. I'm subscribed to several projects, so I should |
11 |
> have one on each CPU all the time, running at nice 19 and therefore |
12 |
> mopping up all available CPU cycles. That's how it used to run. But |
13 |
> nowadays the kernel scheduler insists on allocating both of them to the |
14 |
> same CPU, thus limiting them to 50% load. |
15 |
|
16 |
I noticed the same here -- two or more CPU heavy programs often seem to |
17 |
get stuck on the same CPU now, leaving the other one running virtually |
18 |
idle. =8^( I figured it was dynamics related to the fact that pretty |
19 |
much all the I/O and peripherals are hooked up to the one (CPU 0), making |
20 |
it the more efficient one to run stuff like X on, or anything doing a lot |
21 |
of I/O, while the other is kind of hanging out alone, with only memory |
22 |
and the other CPU directly attached. (Note that it's a dual Opteron |
23 |
system, not a dual core, thus it's not two cores in the same socket with |
24 |
everything attached to it, but two different sockets, with just about |
25 |
everything attached to socket 0, probably so it's easier to run a single- |
26 |
CPU and leave the other empty.) |
27 |
|
28 |
While it might be possible for someone who really knows what they are |
29 |
doing to tweak things to get more even distribution automatically, I |
30 |
decided fiddling with that was way over my head, so I elected to go the |
31 |
other route. |
32 |
|
33 |
The route I took, you have two choices for tools, both in the sys-process |
34 |
category. schedtool compiles into a single binary executable that you |
35 |
call with different parameters depending on what you want it to do. |
36 |
schedutils takes the opposite approach, with several tools, each of which |
37 |
do a particular thing. I chose schedutils since I was mainly interested |
38 |
in only the one tool from it anyway, and learning it while ignoring the |
39 |
others I think is easier than learning the complexities of a single big |
40 |
complex tool most of the functions of which I'm not particularly |
41 |
interested in. |
42 |
|
43 |
So, if you emerge schedutils, one of the binaries you get is called |
44 |
taskset. Once it's emerged, you can read the notes on taskset in /usr/ |
45 |
share/doc/schedutils-*/README.bz2, and/or the taskset manpage. It's |
46 |
pretty simple, to use, however. For example, on a two-core or two-CPU |
47 |
system (CPU0 and CPU1), setting an already running X to run on CPU0 only, |
48 |
on CPU1 only, or on both, is done with the following commands (the number |
49 |
being a CPU bitmask, obviously): |
50 |
|
51 |
taskset -p 1 `pidof X` |
52 |
taskset -p 2 `pidof X` |
53 |
taskset -p 3 `pidof X` |
54 |
|
55 |
The binary bitmasks of course are |
56 |
01=1 |
57 |
10=2 |
58 |
11=3 |
59 |
|
60 |
Any bit that's a one is a CPU the process can run on. So in hex 0xFF, in |
61 |
decimal 255, in binary 1111 1111, would let a process run on any of the |
62 |
first 8 CPUs/cores. |
63 |
|
64 |
It DOES caution not to set it to run on NO CPUs (0 up there in place of |
65 |
the number). If it was a minor user process, it would probably simply |
66 |
suspend (I've not tried it to see), but try it with something like X when |
67 |
you are IN X, and things could get a bit "interesting".) |
68 |
|
69 |
To start a new process while assigning it a specific CPU, you can do this: |
70 |
|
71 |
taskset 2 tail -f /var/log/messages |
72 |
|
73 |
That of course sets it to run on CPU1 (as opposed to CPU0). |
74 |
|
75 |
There's another way of mapping them too, for those who find it hard to |
76 |
think in binary, but I've not used it so don't remember it. It's not |
77 |
hard to memorize the binary bitmaps for 4 CPUs/cores anyway, 0xF in hex, |
78 |
and even easier to memorize it for only two CPUs, as I have now. |
79 |
|
80 |
> It's also odd that CPU1 runs 5 - 6 C hotter than CPU0, whether loaded or |
81 |
> not. |
82 |
|
83 |
That's likely simply a calibration or sensor placement error in one or |
84 |
the other. Here, CPU1 always runs /cooler/ than CPU0, but I think it's |
85 |
because the sensor for CPU1 isn't quite in such direct contact as is the |
86 |
CPU0 sensor, as the CPU0 sensor is always more sensitive as well. CPU0 |
87 |
almost seems as affected by case temp as CPU utilization, so for all I |
88 |
know it's not touching the CPU at all. (As the cost to do so was little |
89 |
more than the cost of the bare parts, bought from the pricewatch.com low |
90 |
price leaders separately, I bought the mobo with the CPUs and fans |
91 |
already mounted and pre-tested working, and have never had them off, so |
92 |
I've never seen /where/ the sensor is actually placed.) |
93 |
|
94 |
As long as your CPUs will shut down before they burn up, and they should, |
95 |
I'd not worry about it. |
96 |
|
97 |
-- |
98 |
Duncan - List replies preferred. No HTML msgs. |
99 |
"Every nonfree program has a lord, a master -- |
100 |
and if you use the program, he is your master." Richard Stallman |
101 |
|
102 |
-- |
103 |
gentoo-amd64@g.o mailing list |