View previous topic :: View next topic |
Author |
Message |
Bash[DevNull] Guru
Joined: 10 Oct 2003 Posts: 333
|
Posted: Sat Mar 11, 2006 7:32 am Post subject: [POLLING] -Os for kernel is good or not? :) |
|
|
Interesting in yours opinion _________________ Biomechanical Artificial Sabotage Humanoid |
|
Back to top |
|
|
bollucks l33t
Joined: 27 Oct 2004 Posts: 606
|
Posted: Sat Mar 11, 2006 10:40 am Post subject: |
|
|
Yes
(If you can find a workload, any workload with hard numbers to show it's better or worse I'll be very very impressed) |
|
Back to top |
|
|
frenkel Veteran
Joined: 13 May 2003 Posts: 1034 Location: .nl
|
Posted: Sat Mar 11, 2006 3:14 pm Post subject: |
|
|
No, get's loaded once and after that stays in memory. It's _the_ most important thing your computer is running, don't optimize for size, but for speed. |
|
Back to top |
|
|
tkdfighter Apprentice
Joined: 14 May 2004 Posts: 271 Location: Bludenz, Austria
|
Posted: Sat Mar 11, 2006 9:12 pm Post subject: |
|
|
If you want to run the Linux kernel on an embedded system, you should probably optimize for size using -Os. But for any other computer you will want to go for -O2.
But that's just my 2c. |
|
Back to top |
|
|
bollucks l33t
Joined: 27 Oct 2004 Posts: 606
|
|
Back to top |
|
|
stef Tux's lil' helper
Joined: 23 Jul 2003 Posts: 93
|
Posted: Wed Mar 15, 2006 10:16 am Post subject: |
|
|
Well, I am using -Os for my kernel now
(have been using -Os as CFLAG for my system some time and well ... had more ram which for me felt speeding up things as less swapping makes everything way faster) ...
I recently changed back my CFLAGS to -O2 since -Os caused some bad binaries for some kde packages (gcc is a hard thing to keep working correctly)
but so far kernel seems to be running perfectly so i keep this... (and maybe also try -Os for CFLAGS again and see if gcc does it now) |
|
Back to top |
|
|
Bash[DevNull] Guru
Joined: 10 Oct 2003 Posts: 333
|
Posted: Wed Mar 15, 2006 1:52 pm Post subject: |
|
|
stef wrote: | Well, I am using -Os for my kernel now
(have been using -Os as CFLAG for my system some time and well ... had more ram which for me felt speeding up things as less swapping makes everything way faster) ...
I recently changed back my CFLAGS to -O2 since -Os caused some bad binaries for some kde packages (gcc is a hard thing to keep working correctly)
but so far kernel seems to be running perfectly so i keep this... (and maybe also try -Os for CFLAGS again and see if gcc does it now) |
and how much RAM in your system?
On my NoteBook just 256Mb... so im thinking to change -O3 to -Os for all packages... _________________ Biomechanical Artificial Sabotage Humanoid |
|
Back to top |
|
|
stef Tux's lil' helper
Joined: 23 Jul 2003 Posts: 93
|
Posted: Sat Mar 18, 2006 12:10 pm Post subject: |
|
|
I have 512 MB on AMD64 (so progs get a little bigger because of pointers being 64 instead of 32 bit)
But well .. yesterday i got IO error on my hd, so I guess it maybe still buggy gcc for me on -Os .. so i'll switch back to normal compilation for kernel and see if it's bad hardware or really a software/compiler problem) |
|
Back to top |
|
|
Kaapeli Tux's lil' helper
Joined: 27 Dec 2004 Posts: 110 Location: Oulu, Finland
|
Posted: Sat Mar 18, 2006 8:14 pm Post subject: |
|
|
(quoted from the above website)
Quote: |
Well the kernel is a different beast to userspace. The cycles saved by using
O2 in the kernel are almost certainly offset by the extra icache footprint of
the larger kernel created by O2 versus Os. In the kernel's case, compiling
for size effectively allows more ram for userspace to use. Thus, optimising
the kernel for size can speed up userspace. |
My thought is that saving a few megabytes doesn't really have any significant speedup on userspace, especially if you already have a gigabyte of ram or so. I understand that if you're very low in ram, saving a few megabytes can make a difference, but PCs today tend to have so much ram that saving a few megabytes will only have very marginal effect on userspace performance.
Quote: | It is not common that a kernel
function itself actually costs you much in cpu cycles, so this is a better
compromise - most of your cycles are spent in userspace. If the kernel _is_
using a lot of cpu cycles then that is a bug in the kernel and O2 isn't the
way to fix it. |
I thought that the sys column on top and vmstat indicates the amount of CPU cycles spent on kernel mode. When running some scripts that forks a lot (emerging something for example), it's not uncommon for me to see the sys percentage to go above 50% level. Does that mean my CPU is spending way too much time in kernel mode or something else? _________________ Temperatures |
|
Back to top |
|
|
bollucks l33t
Joined: 27 Oct 2004 Posts: 606
|
Posted: Sun Mar 19, 2006 12:44 am Post subject: |
|
|
Kaapeli wrote: | My thought is that saving a few megabytes doesn't really have any significant speedup on userspace, especially if you already have a gigabyte of ram or so. I understand that if you're very low in ram, saving a few megabytes can make a difference, but PCs today tend to have so much ram that saving a few megabytes will only have very marginal effect on userspace performance. |
The L1 cache in your cpu is absolutely miniscule. This isn't about ordinary ram. Check the output of the command:
and you'll see why it counts. This is the fastest ram your CPU operates from, followed by the L2 cache (substitute L1 above with L2). This does matter.
Kaapeli wrote: | I thought that the sys column on top and vmstat indicates the amount of CPU cycles spent on kernel mode. When running some scripts that forks a lot (emerging something for example), it's not uncommon for me to see the sys percentage to go above 50% level. Does that mean my CPU is spending way too much time in kernel mode or something else? |
That's usually for short bursts when you are calling on system resources and are limited in ways beyond simple CPU "calculations". Most things spend their time in userspace, and if they don't there's something wrong. Real cpu bound things like mp3 encoding and the like use close to zero system time except when waiting on I/O.
As I said originally, though: If you can find any hard evidence it helps either way I'll be impressed. |
|
Back to top |
|
|
stef Tux's lil' helper
Joined: 23 Jul 2003 Posts: 93
|
Posted: Thu Mar 23, 2006 11:25 am Post subject: |
|
|
just for information:
switched back to kernel without -Os after the IO error mentioned above.
s.m.a.r.t. does not find any errors and I didn't get any IO errors anymore,
so seems to be a bug in gcc (GCC) 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8 )
on amd64 .. at least for me. (hopefully they'll get -Os fixed in gcc some days)
just in case one didn't think of L1/L2 caches and is too lazy to look it up - here' mine:
CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
CPU: L2 Cache: 512K (64 bytes/line)
so really some MB more or less do make a difference. |
|
Back to top |
|
|
stef Tux's lil' helper
Joined: 23 Jul 2003 Posts: 93
|
Posted: Fri Apr 07, 2006 12:17 pm Post subject: |
|
|
switched to gcc 4.1 ... and now trying -Os kernel 2.6.16-r1 - up to now everything fine! |
|
Back to top |
|
|
sirdilznik l33t
Joined: 28 Apr 2005 Posts: 731
|
Posted: Fri Apr 07, 2006 3:16 pm Post subject: |
|
|
I've been running -Os for my kernel since it became an option (rest of my system is -O2). As far as stability goes I've had zero issues. As far as performance goes, I agree with bollucks, performance difference is negligible if any. |
|
Back to top |
|
|
|