Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Documentation, Tips & Tricks
  • Search

Tweaking cpufreq_conservative.c

Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Post Reply
Advanced search
4 posts • Page 1 of 1
Author
Message
jserink
Veteran
Veteran
Posts: 1036
Joined: Fri Jan 30, 2004 7:57 am

Tweaking cpufreq_conservative.c

  • Quote

Post by jserink » Tue Feb 12, 2008 2:38 pm

Hi All:

On my ferarri 5000 AMD turion 64x2 laptop, the conservative frequency governor was working but not as fast as I would have liked.
To speed it up, I put this line in my /etc/conf.d/local.start:
cat /sys/devices/system/cpu/cpu0/cpufreq/conservative/sampling_rate_min > /sys/devices/system/cpu/cpu0/cpufreq/conservative/sampling_rate

Problem is, my sampling_rate_min was 3200000 or 3.2 seconds which means my CPU would need to be more than 80% for over 3 seconds before anything would happen. AND, you just can't push say 1000000 into sampling_rate, it will reject it. Same if you tried that with sampling_rate_min.

Ok, this is Linux and I have the source, its hack time......
and our victim is, cpufreq_conservative.c.
In that file you will find this line:
#define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000)

I changed that value to 100 which basically means my min sampling rate should drop from 3.2 seconds to 0.32 seconds. The file is very well commented so you can have a read as to what does what.
Recompiled the modules, loaded them up and bang, worked like a charm. Now my laptop's frequency reacts nice an quick to any increased load.

Cheers,
John
Top
Jinidog
Guru
Guru
User avatar
Posts: 593
Joined: Wed Nov 26, 2003 7:21 pm
Location: Berlin
Contact:
Contact Jinidog
Website

  • Quote

Post by Jinidog » Tue Feb 12, 2008 9:06 pm

Why not simply use the "ondemand" governor?
Just unused Microsoft-Software is good Microsoft-Software
Top
jserink
Veteran
Veteran
Posts: 1036
Joined: Fri Jan 30, 2004 7:57 am

on demand governor

  • Quote

Post by jserink » Wed Feb 13, 2008 1:58 am

Because the ondemand governor takes my machine from 800MHz to 2000MHz in one go, nothing in between.
Also, the not sure what the min sampling rate is for th eon demand governor is, haven't checked.
Top
Neo2
Apprentice
Apprentice
Posts: 224
Joined: Mon Sep 25, 2006 3:05 pm
Location: Italy

  • Quote

Post by Neo2 » Tue Feb 19, 2008 1:36 pm

Please read some docs at www.lesswatts.org, if you really want to save power (for longer battery life I guess). You should try to reduce the number of wakeups per second from idle states for your CPU and make sure that the CPU will stay in idle and deeper (C2, C3) states for longer time. What you're doing instead will make your CPUs wake up at least 3 times more in a second, not counting additional overhead for the execution of the sampling algorithm for the conservative governor. That hack will probably lead to shorter battery life than you currently have (not that much, but it's always less).
Emerge powertop and give it a try. I reduced my laptop wakeups from ~200ps to ~65ps. It's not optimal, but it's always better than nothing. Now my battery lasts 3.3 hours instead of 2.1.
If you want powertop to work at its best you should recompile your kernel with following options:

Code: Select all

CONFIG_TIMER_STATS=y (will enable timer statistics, slight overhead)
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y (these two will enable you to see from powertop which kernel routines are waking up your CPU. slight overhead)
Instead, for direct tweaking:

Code: Select all

CONFIG_NO_HZ=y (this will try to wakeup the CPU only when an interrupt makes a request)
CONFIG_HZ_100=y
CONFIG_HZ=100 (these two will make your kernel wake up lesser times per second, I've seen nice performance boost, though CONFIG_NO_HZ should make this useless)
Once you're done with tweaking you may as well remove the first three options to remove the slight performance impact they have.
Ondemand governor is recommended because it will make your CPU react faster to events, so that you can get back to idle states in shorter time.
This is for powersaving/performance... but of course, if you just want your CPU react quickly and don't mind spending battery life that hack is okay :wink:
Neo2
Unofficial minimal liveCD for x86/amd64 w/reiser4+truecrypt
Top
Post Reply

4 posts • Page 1 of 1

Return to “Documentation, Tips & Tricks”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic