Am 23.11.2010 17:42, schrieb 7v5w7go9ub0o:
> FYI. If anyone understands the bash tweak, please explain :-)
> 
> TIA
> 
> 1. Original article: "The ~200 Line Linux Kernel Patch That Does Wonders"
> <http://www.phoronix.com/scan.php?page=article&item=linux_2637_video&num=1>
> 
> 2. The alternative (or additional) bash tweak:
> <http://www.webupd8.org/2010/11/alternative-to-200-lines-kernel-patch.html>
> 

There is already a thread to this. But to answer your question:

The shell script version does nothing more than add the shell process to
a new cgroup (control group). Every child process of that shell will
automatically be added to the same cgroup.

The scheduler will then make sure that all cgroups will get a fair share
of CPU time and disk i/o.[1] If one group spawns many CPU-hungry
processes (like a kernel build with `make -j 64 all`), all other
processes are somewhat isolated from these.

The processes are still equal in their scheduling priority but the
scheduler's first priority will be to schedule equally among cgroups.
That means that you cannot starve processes of resources simply by
spawning an overwhelming number of processes demanding the same
resource. You can only starve processes within your own cgroup.[2]

I cannot tell you what the kernel patch does differently, though.

BTW: I've implemented a slightly adjusted version of the bash script
(Ubuntu alternative) for Gentoo yesterday and I must say, I'm really
impressed. My Core i5 M450 could handle a `make -j 64 all` without any
impact on desktop performance. I could only notice it by playing a DVD
with MPlayer: The framerate dropped to 21 FPS (still watchable with
'-framedrop'). :D

[1] I think the kernel handles all processes which do not belong to any
cgroup like they belonged to a single cgroup.

[2] Here is a tutorial for the more advanced functions of cgroups. It
includes really cool features like /soft/ performance guarantees.
http://broadcast.oreilly.com/2009/06/manage-your-performance-with-cgroups-and-projects.html


Hope this helps,
Florian Philipp

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to