1 |
Am 23.11.2010 17:42, schrieb 7v5w7go9ub0o: |
2 |
> FYI. If anyone understands the bash tweak, please explain :-) |
3 |
> |
4 |
> TIA |
5 |
> |
6 |
> 1. Original article: "The ~200 Line Linux Kernel Patch That Does Wonders" |
7 |
> <http://www.phoronix.com/scan.php?page=article&item=linux_2637_video&num=1> |
8 |
> |
9 |
> 2. The alternative (or additional) bash tweak: |
10 |
> <http://www.webupd8.org/2010/11/alternative-to-200-lines-kernel-patch.html> |
11 |
> |
12 |
|
13 |
There is already a thread to this. But to answer your question: |
14 |
|
15 |
The shell script version does nothing more than add the shell process to |
16 |
a new cgroup (control group). Every child process of that shell will |
17 |
automatically be added to the same cgroup. |
18 |
|
19 |
The scheduler will then make sure that all cgroups will get a fair share |
20 |
of CPU time and disk i/o.[1] If one group spawns many CPU-hungry |
21 |
processes (like a kernel build with `make -j 64 all`), all other |
22 |
processes are somewhat isolated from these. |
23 |
|
24 |
The processes are still equal in their scheduling priority but the |
25 |
scheduler's first priority will be to schedule equally among cgroups. |
26 |
That means that you cannot starve processes of resources simply by |
27 |
spawning an overwhelming number of processes demanding the same |
28 |
resource. You can only starve processes within your own cgroup.[2] |
29 |
|
30 |
I cannot tell you what the kernel patch does differently, though. |
31 |
|
32 |
BTW: I've implemented a slightly adjusted version of the bash script |
33 |
(Ubuntu alternative) for Gentoo yesterday and I must say, I'm really |
34 |
impressed. My Core i5 M450 could handle a `make -j 64 all` without any |
35 |
impact on desktop performance. I could only notice it by playing a DVD |
36 |
with MPlayer: The framerate dropped to 21 FPS (still watchable with |
37 |
'-framedrop'). :D |
38 |
|
39 |
[1] I think the kernel handles all processes which do not belong to any |
40 |
cgroup like they belonged to a single cgroup. |
41 |
|
42 |
[2] Here is a tutorial for the more advanced functions of cgroups. It |
43 |
includes really cool features like /soft/ performance guarantees. |
44 |
http://broadcast.oreilly.com/2009/06/manage-your-performance-with-cgroups-and-projects.html |
45 |
|
46 |
|
47 |
Hope this helps, |
48 |
Florian Philipp |