Re: [gentoo-user] 200-line patch to kernel = superkernel

2010-11-26 Thread Stefan G. Weichinger
Am 2010-11-25 16:37, schrieb Florian Philipp:

 Anyway, if you want my solution, here it is, although it's mostly
 copy'n'paste from the original link:

[...]

 Hope this helps,
 Florian Philipp

Thanks a lot for that howto, Stefan





Re: [gentoo-user] 200-line patch to kernel = superkernel

2010-11-25 Thread Stefan G. Weichinger
Am 23.11.2010 19:26, schrieb Florian Philipp:

 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.

Would you share?



Re: [gentoo-user] 200-line patch to kernel = superkernel

2010-11-25 Thread Adam Carter
 Would you share?

 +1

I only have an empty /sys/fs/cgroup with the following config on 2.6.36, so
please share the kernel config as well.

# zgrep CGROUP /proc/config.gz
CONFIG_CGROUPS=y
# CONFIG_CGROUP_DEBUG is not set
CONFIG_CGROUP_NS=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
# CONFIG_CGROUP_MEM_RES_CTLR is not set
CONFIG_CGROUP_SCHED=y
CONFIG_BLK_CGROUP=y
# CONFIG_DEBUG_BLK_CGROUP is not set
# CONFIG_NET_CLS_CGROUP is not set


Re: [gentoo-user] 200-line patch to kernel = superkernel

2010-11-25 Thread Florian Philipp
Am 25.11.2010 12:21, schrieb Adam Carter:
 
 Would you share?
 
 +1
 
 I only have an empty /sys/fs/cgroup with the following config on 2.6.36,
 so please share the kernel config as well.
 

I guess you have to mount your cgroup there, first. The original link
describes, how.

I don't have a /sys/fs/cgroup at all. So I don't think my kernel config
will help you.

My solution isn't that great, anyway. I thought about writing an init
script but I haven't done that yet and don't think I'll do it soon.

Anyway, if you want my solution, here it is, although it's mostly
copy'n'paste from the original link:

1. Create '/usr/local/sbin/cgroup_start' with the following content:

#!/bin/bash
mkdir -p /dev/cgroup/cpu
mount -t cgroup cgroup /dev/cgroup/cpu -o cpu
mkdir -m 0777 /dev/cgroup/cpu/user
/bin/echo '/usr/local/sbin/cgroup_clean'  /dev/cgroup/cpu/release_agent

(Execution right for root, only)

## Please note ##
Since I had no /sys/fs/cgroup directory to start with and I didn't want
to fiddle with /proc or /sys, I create a new directory /dev/cgroup to
work with. If you have a better directory, you have to adjust all
following code snippets to work on that directory.

Please also note that I use /bin/echo instead of the shell built-in
echo. There is supposed to be a difference in write error detection
between the both which is important to detect problems when you
configure cgroups.
#

2. Create '/usr/local/sbin/cgroup_clean'

#!/bin/sh
rmdir /dev/cgroup/cpu/$*

(Execution right for root, only)

3.a If you use OpenRC / Baselayout-2, edit /etc/conf.d/local

local_start() {
/usr/local/sbin/cgroup_start

# We should always return 0
return 0
}

3.b If you use Baselayout-1, edit /etc/conf.d/local.start and add

/usr/local/sbin/cgroup_start

## Please note ##
It would be great to know what to do in order to stop using cgroups
again. Then we could create a proper init script for this. Does anyone know?
Can you just unmount it? Do you need to delete its content, first?
#

4. Create a file /etc/bash/local/cgrouprc

if [ $PS1 ] ; then
   mkdir -p -m 0700 /dev/cgroup/cpu/user/$$  /dev/null 21
   /bin/echo $$  /dev/cgroup/cpu/user/$$/tasks
   /bin/echo 1  /dev/cgroup/cpu/user/$$/notify_on_release
fi

5. Edit your own ~/.bashrc file and /root/.bashrc and add the following
line:

source /etc/bash/local/cgrouprc

## Please note ##
The last two steps can be varied as you wish. The creation of a
/etc/bash/local directory is my own policy. It is useful for collecting
common bashrc code that all users can include as they wish.
#

Then call `/etc/init.d/local restart` and type `source ~/.bashrc` in all
your open shells and you are done.

Hope this helps,
Florian Philipp



signature.asc
Description: OpenPGP digital signature


Re: [gentoo-user] 200-line patch to kernel = superkernel

2010-11-25 Thread Florian Philipp
Am 24.11.2010 22:13, schrieb Mick:
 On Tuesday 23 November 2010 16:42:51 7v5w7go9ub0o wrote:
 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=articleitem=linux_2637_videonum=1

 2. The alternative (or additional) bash tweak:
 http://www.webupd8.org/2010/11/alternative-to-200-lines-kernel-patch.html
 
 The second link keeps crashing my konqueror ...

Yep, here too. Interesting ...



signature.asc
Description: OpenPGP digital signature


Re: [gentoo-user] 200-line patch to kernel = superkernel

2010-11-25 Thread Sebastian Beßler

Am 25.11.2010 16:40, schrieb Florian Philipp:

Am 24.11.2010 22:13, schrieb Mick:

On Tuesday 23 November 2010 16:42:51 7v5w7go9ub0o wrote:



2. The alternative (or additional) bash tweak:
http://www.webupd8.org/2010/11/alternative-to-200-lines-kernel-patch.html


The second link keeps crashing my konqueror ...


Yep, here too. Interesting ...



Here it works without problems in konqueror

Konqueror
Version 4.5.80 (4.6 Beta1)
Unter KDE 4.5.80 (4.6 Beta1)

Greetings

Sebastian Beßler



Re: [gentoo-user] 200-line patch to kernel = superkernel

2010-11-24 Thread Mick
On Tuesday 23 November 2010 16:42:51 7v5w7go9ub0o wrote:
 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=articleitem=linux_2637_videonum=1
 
 2. The alternative (or additional) bash tweak:
 http://www.webupd8.org/2010/11/alternative-to-200-lines-kernel-patch.html

The second link keeps crashing my konqueror ...
-- 
Regards,
Mick


signature.asc
Description: This is a digitally signed message part.


[gentoo-user] 200-line patch to kernel = superkernel

2010-11-23 Thread 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=articleitem=linux_2637_videonum=1

2. The alternative (or additional) bash tweak:
http://www.webupd8.org/2010/11/alternative-to-200-lines-kernel-patch.html



Re: [gentoo-user] 200-line patch to kernel = superkernel

2010-11-23 Thread Paul Hartman
On Tue, Nov 23, 2010 at 10:42 AM, 7v5w7go9ub0o 7v5w7go9u...@gmail.com wrote:
 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=articleitem=linux_2637_videonum=1

 2. The alternative (or additional) bash tweak:
 http://www.webupd8.org/2010/11/alternative-to-200-lines-kernel-patch.html

It's not so much a bash tweak (the example is how to do it inbash),
the meat of it is that it is setting up some cgroups stuff. I won't
pretend to understand exactly how they work, but check out the Linux
kernel documentation for more detailed info and examples:

/usr/src/linux/Documentation/cgroups/



Re: [gentoo-user] 200-line patch to kernel = superkernel

2010-11-23 Thread Florian Philipp
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=articleitem=linux_2637_videonum=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



signature.asc
Description: OpenPGP digital signature