The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.

    customizing kernel for notebook - do you have any tips?

    Discussion in 'Linux Compatibility and Software' started by helikaon, Mar 16, 2010.

  1. helikaon

    helikaon Notebook Consultant

    Reputations:
    269
    Messages:
    288
    Likes Received:
    0
    Trophy Points:
    30
    Hi guys,
    I'd like to ask you, if you have any particular tips when (if) you compile your own kernel for your laptop?
    As for me, except usual stuff appropriate like selecting the HW drivers and CPU type coresponding with your laptop - I have 2 questions:

    1. which cpu governor you use as default?
    me:
    [root@orionis boot]# cat config-2.6.32.9-r61-0 | grep -i CONFIG_CPU_FREQ_GOV
    CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
    CONFIG_CPU_FREQ_GOV_POWERSAVE=y
    CONFIG_CPU_FREQ_GOV_USERSPACE=y
    CONFIG_CPU_FREQ_GOV_ONDEMAND=y
    CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y

    so I've got all govs compiled in and default is 'userspace':
    [root@orionis boot]# cat config-2.6.32.9-r61-0 | grep -i CONFIG_CPU_FREQ_DEFAULT_GOV
    # CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
    # CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
    CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
    # CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
    # CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set

    This being said, if i'm on battery only i just switch to conservative:
    [root@orionis boot]# cpufreq-selector -g conservative

    2. which I/O scheduler you use for the HDD access ?
    [root@orionis boot]# cat config-2.6.32.9-r61-0 | grep -i CONFIG_IOSCHED
    CONFIG_IOSCHED_NOOP=y
    CONFIG_IOSCHED_AS=y
    CONFIG_IOSCHED_DEADLINE=y
    CONFIG_IOSCHED_CFQ=y

    my default is anticipatory (changed that from CFQ):
    [root@orionis boot]# cat config-2.6.32.9-r61-0 | grep -i CONFIG_DEFAULT_
    CONFIG_DEFAULT_AS=y
    # CONFIG_DEFAULT_DEADLINE is not set
    # CONFIG_DEFAULT_CFQ is not set
    # CONFIG_DEFAULT_NOOP is not set
    CONFIG_DEFAULT_IOSCHED="anticipatory"

    If you ever played with this, did you notice any performance change?
    Or if you have any other tips relating to e.g. battery life, or performance kernel tunning for laptop?
    I know it's dependant on the HW your laptop is built from, but I'm just curious, so share if you will, even if it's not relevant to my HW (intel) platform ....

    nice day to you all
     
  2. roscop

    roscop Newbie

    Reputations:
    0
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    5
    Hello,

    Just my point of view about parameters you expose, then some others.

    About the governor, i use conservative by default. ondemand is a bit more responsive if you wish but also rise freq to the higher level (except IDA) and at last your notebook got warmer.

    About Scheduler, i also run on 2.6.32 and since it was deeply re-worker CFQ do a good job with hard drive. But for an ide ssd on another notebook i recently switch back to anticipatory because i got lot of freeze with cfq and now all is fine. Not sure it's related but i talk about experiences i encountered.

    Anyway, for both of them, i think it could be better to compile unset (but wished) governor/scheduler as module, free a bit your kernel mem it will thank you ;)

    Whatelse, well if ubuntu don't integrate it, consider the linux-phc patch to manage your cpu voltage. Most of time you can expect nice result, system run cooler and battery stay up longer.

    If you use your notebook for general purpose, try PREEMPT_VOLUNTARY whereas PREEMPT, last one can degrade conservative job on long time.

    I guess if you ask about all of it you already tweaked you kernel a bit, reducing wide counter, remove unneeded feature, enabling powertop trick to track any power loss, proc/sys tune, etc ... if not, and which to get some info, i'll glad to help you.

    Last thing, i don't know which window manager you use but if it work well with hal/acpi, you can appreciate to see brightness, peripheral activity, etc, tuned by it.

    Regards
     
  3. helikaon

    helikaon Notebook Consultant

    Reputations:
    269
    Messages:
    288
    Likes Received:
    0
    Trophy Points:
    30
    Roscop,
    thanks for information!
    I think I'm gonna:
    - recompile with conservative as default and set rest as modules
    - will stay with anticipatory I/O scheduler

    Can you a bit explain your note about the preempt_voluntary you mentioned?
    my settings is:
    [root@orionis boot]# cat config-2.6.32.10-r61-0 | grep -i PREEMPT
    # CONFIG_TREE_PREEMPT_RCU is not set
    CONFIG_PREEMPT_NOTIFIERS=y
    # CONFIG_PREEMPT_NONE is not set
    CONFIG_PREEMPT_VOLUNTARY=y
    # CONFIG_PREEMPT is not set

    Also I use tickless system as cpu feature:
    #
    # Processor type and features
    #
    CONFIG_TICK_ONESHOT=y
    CONFIG_NO_HZ=y
    # CONFIG_HIGH_RES_TIMERS is not set

    Also, I run CentOS 5.4 with kde 3.5, so I use kwin as window manager. I'm just trying to get the best off my laptop, so i switched to non-centos kernel :).

    Also I've installed laptop-mode-tools:
    Installed Packages
    Name : laptop-mode-tools
    Arch : noarch
    Version : 1.32
    Release : 1.el5.rf
    Size : 182 k
    Repo : installed
    Summary : Tools to spin down hard disks automatically for power savings
    URL : http://www.xs4all.nl/~bsamwel/laptop_mode/tools/

    Q:
    Anyone here use this tools? Experience? I don't run it by default (started as system service automatically), I run it by hand, when needed, because i'm afraid of the HDD wearing off by spinning it down too much ....
     
  4. zephyrus17

    zephyrus17 Notebook Deity

    Reputations:
    646
    Messages:
    1,576
    Likes Received:
    0
    Trophy Points:
    55
    I don't see a point. The amount of 'speed increase' you get from this will never justify your time spent on tweaking it.
     
  5. helikaon

    helikaon Notebook Consultant

    Reputations:
    269
    Messages:
    288
    Likes Received:
    0
    Trophy Points:
    30
    You're totally right considering the speed, but i'm curious minded person and by doing so I learn lots things, which is a fair trade for me.
    I started compiling kernel for my laptop, because i started to use RHEL 5.x in 2007 on it and wanted support for my wifi and card reader. So, from time to time i just download new kernel and recompile :).
     
  6. Bog

    Bog Losing it...

    Reputations:
    4,018
    Messages:
    6,046
    Likes Received:
    7
    Trophy Points:
    206
    If you're doing this more for the learning experience rather than the (small) performance benefit, consider LFS (Linux From Scratch).
     
  7. weinter

    weinter /dev/null

    Reputations:
    596
    Messages:
    2,798
    Likes Received:
    1
    Trophy Points:
    56
    QFT
    I was previously in the same position trying to compile to get the most speed, but actually the milliseconds improvement doesn't justify the hours of compilation...it just doesn't add up.
    Compiling from scratch to understand the system better seems better justified.
     
  8. helikaon

    helikaon Notebook Consultant

    Reputations:
    269
    Messages:
    288
    Likes Received:
    0
    Trophy Points:
    30
    As I've said, I started to compile kernel because of my laptop HW was not supported in original RHEL 5.x. Since my laptop is already older, the drivers were already backported to original native RHEL kernel. But I simply like it to see myself 'behind' the desktop surface and see new things in kernel - just testing a little brtfs now :).
    Also, I work with RHEL servers, so having it on laptop (CentOS) helps me a lot with my job - otherwise i'd probably go for 'newer' distribution at the time.
    And the compilation itself takes roughly 20 minutes on my ntb and with usage of previous kernel config the work itself is done in 'no time' so 'hours compilation' is not my case. :)
     
  9. jas

    jas Notebook Evangelist

    Reputations:
    697
    Messages:
    622
    Likes Received:
    5
    Trophy Points:
    31
    Sorry for being late to the thread..

    Well as most tinkerers do, I tend to like these kinds of discussions and system tweaking. Not for any single performance boost, although collectively they can add up to an impressive overall improvement, but as has been mentioned, it's cool to learn more about the inner workings of your OS. You might be surprised what you discover.
    I've read for awhile that the preferred kernel CPU scaling choice is the on-demand CPU governor, as that's supposed to provide the best balance between using your CPU at max speed when you need it, and saving on power when you don't. I have an i7 in my main laptop now, and Intel has included an on demand CPU scaling technology in at least their "extreme" CPUs, so I'm not sure it's needed anymore. I use the KDE 4 profiles so that when I'm plugged in, the CPU scaling is performance, and when unplugged, it's on-demand. I'm not sure I see much of a difference in system performance as it relates to CPU scaling, although admittedly I never use a conservative profile, so this choice may have more impact than it appears to me. My general suggestion is to first try performance, and see if you can live with the battery performance. If so, leave it at that. If not, switch to on-demand. If you need better battery performance, try conservative, etc.
    The best I/O scheduler to use, will be largely dependent on what kind of HDD you use. The general consensus, echoed in this article, is that if you use the traditional HDD, CFQ, is the best option. Here's the relevant quote;
    So if you use an SSD then as the prior mentioned article, as well as others, suggest, noop my be a good I/O scheduler to consider. However, because of both Dan Weinreb's blog post recommendation, and Theodore Tso's comments on the subject, I actually use deadline as my I/O scheduler. I do know that since switching my I/O scheduler from CFQ to deadline, I have seen a big improvement, but this is specific to using SSDs.

    In the end, picking the right I/O scheduler is important. The other thing to note is that with the 2.6.33 version of the Linux kernel, the anticipatory scheduler will be removed. You might want to test out CFQ, (if you're using standard HDDs), and see if it works as well for you, in anticipation of the upcoming change. BTW, for anyone who wants a good read on Linux I/O schedulers in general, this is a good article.
    When I switched to an i7 quad core CPU, I wanted to make sure I tweaked the kernel appropriately. To that end I read this thread over at the Gentoo Forums, and I specifically tweaked the following options;

    Processor type and features --->
    Preemption Model --->
    I selected Preemtible Kernel (Low-Latency Desktop)

    and

    Processor type and features --->
    Timer frequency --->
    I selected 300 Hz

    This did improve my system responsiveness and performance overall, but I believe this is highly dependent on the laptop hardware. The general suggestion is to try each option, and see if you experience a system improvement. If not, then change your kernel settings back. This is a good article on preemption and the Linux kernel, and this is another performance related thread over at the Gentoo User Forums which makes for some interesting reading on Linux kernel 2.6 performance tweaks in general.

    Lastly, I believe it's an often overlooked tweak, which I was reminded of when I changed to SSDs and I read Dan Weinreb's aforementioned blog post, but a big system performance tweak, available to everyone, for sometimes little additional investment, is to overload your laptop with RAM and setup a RAM disk for your temporary files. Not only system tmp directories, but web browser temp files, and anything else you can think of that you don't need persistently. For my system, (Gentoo), I put 8GB of memory in my laptop, and moved not only /tmp to my newly created 4GB RAM disk, but also my portage tmpdir to RAM disk as well. I also configured my system to compile my kernels on the RAM disk. So while this was obviously done to save wear and tear on my SSD, it's also blazing fast to do most any compilations now, as they are completely done in RAM.

    As a matter of fact the only compilation I can't do in this RAM disk is OpenOffice, (yes, I compile it from source and you need about 6gb free disk space), but after moving to an SSD, my compile time when from 3 hours to 1 hour. So for my money an SSD is the single biggest performance improvement anyone can make in their system. It's just not cost effective right now, especially when you compare a standard SATA HDD to a SATA SSD, for price/space.

    Anyway..
     
  10. helikaon

    helikaon Notebook Consultant

    Reputations:
    269
    Messages:
    288
    Likes Received:
    0
    Trophy Points:
    30
    Great post Jas, thanks, +rep :)