[Module] SmartassV2/ondemandX governors for Rooted/stock ROM | 2012-02-24

Search This thread

AnDyX

Senior Member
May 27, 2008
195
452
Ruda Śląska
This modules are for people with stock kernels because they don't have 'smartass' or ondemandX' governors.

EASY ENGLISH:
Differences between this modules and build in stock kernels:
- allows to set max CPU freq when screen is off (to save battery),
- allows to set starting CPU freq when phone awakes (to speed up awake process),
- allows set/change almost all aspects of governor (to suite needs),
- should be a bit more responsive when parameters are well chosen for smartassv2 governor.

Each governor has some predefinied values - more info in "Available settings".

If governors works or not on other version then 4.0.2.A.0.42 let me know.

Start:
The goal was bring 'smartassv2' and 'ondemandX' governor to work with stock kernel on Neo V.

Most information is in my thread on 'XPERIA X8 Android Development': [Module] | X8 | X10 mini/pro | AX8_SMARTASS v002 | 'smartass' governor | [2011-07-19]

To remind:
SmartassV2 (informal description and comparison with the first smartass)

SmartassV2 is a governor (controls the frequency of the CPU at each give moment) which like the first smartass is generally based on the implementation of interactive with some major changes and the addition of a built in sleep profile (behaves a bit differently when screen is off vs. on).

The smartassV2 improves the very naive scheme which the first smartass had: The first smartass (with the values I set for the hero), would cap the max frequency at 352Mhz for sleep and when screen is on, would do the opposite and keep the frequency at 518Mhz or above. For sleep this was very effective but a bit crude and unclean, and there could be some cases where you would need processing power even when screen is off (something is updating and music is playing and etc.). For screen on, smartass1 was too quick to jump to the max available frequency and again would never go below the 518Mhz, so in a nutshell its was using "too high" frequencies.

SmartassV2, introduce (internally) an "ideal" frequency which is the frequency we are "aiming" for, in some sense. The way I see it is that the "ideal" frequency is a hint to the governor what is a good balance between performance and battery life. Now when screen is on, I set (on the hero) the ideal frequency to 518Mhz which will ensure nice responsiveness but limit unnecessary use of higher frequencies when they are not needed. When screen is off, I set the ideal frequency to 352Mhz (0 will disable the screen state tracking all together). From my testing this will "convince" the governor to spend most of the its time during sleep at the lowest available frequencies. Note, that both during sleep and when awake the entire frequency range (as defined by the "user" - i.e. selected with SetCPU) is used by smartassV2. For example, when the CPU is loaded heavily, the highest available frequency will be used regardless if screen is on or off.

ondemandX - ondemand governor code from latest linux (3.0 at the moment) source *plus* the suspend/wake logic described above. No further optimization is done.

Info:
- information about governors is here,
- more information about 'smartass' governor is here or here,
- how different governors work is explained here: [Q] SetCPU governors (explained).


Prerequisites:
- Neo V (if works on Neo - let me know),
- root,
- ondemandX should work on any version,
- smartass was compiled against 4.0.2.A.0.42 version, how run on other version will be explained in manuall installation section,
- desire to replace SetCPU - when used only for 'ScreenOff' profile.

Manual installation:
  1. Unzip file
  2. Run copy.cmd file - this should copy modules to /system/lib/modules
  3. run adb shell or terminal - whatever you like and execute su
    Code:
    su
  4. If you have 4.0.2.A.0.42 version proceed to step 6
  5. For smartass governor you need to know address for 'kallsyms_lookup_name'
    run following command:
    Code:
    cat /proc/kallsyms | grep kallsyms_lookup_name
    result should be as follows:
    Code:
    80101aec T module_kallsyms_lookup_name
    [SIZE="3"][B]801056f0[/B][/SIZE] T kallsyms_lookup_name
    Bolded value (801056f0) is address which we need.
  6. Optional step: lower min CPU freq:
    Code:
    echo 122880 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
  7. Insert ondemandX module:
    Code:
    insmod /system/lib/modules/aneov_ondemandx.ko
    in dmesg command should be line:
    Code:
    <6>[  431.711517] aneov_ondemandX: module v001 for device Xperia Neo V loaded
  8. Insert smartassV2 module:
    • for version 4.0.2.A.0.42 just run command:
      Code:
      insmod /system/lib/modules/aneov_smartass2.ko
      in dmesg command should be line:
      Code:
      <6>[  420.308380] aneov_smartass2: module v001 for device Xperia Neo V loaded
    • for other use 'address' and use following command:
      Code:
      insmod /system/lib/modules/aneov_smartass2.ko lookup_address=0x[B][COLOR="Red"]801056f0[/COLOR][/B]
      in dmesg command should be line:
      Code:
      <6>[  420.308380] aneov_smartass2: module v001 for device Xperia Neo V loaded
  9. Now you can enable desired governor. Execute:
    Code:
    echo "smartassV2" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
for smartassV2 or
Code:
echo "ondemandX" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
for ondemandX governor.

Lower min cpu freq a bit:
Code:
echo 122880 >  /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

Until you're sure that it works with your hardware, don't install it to hw_config.sh.

Available settings:
Will be added later

v001:
- just initial version fixed to work with Neo V.

Disclaimer
I'm not responsible if this module damages your lovely phone. Use it at your own risk! Think before you do something!

Sources at: GitHub
 

Attachments

  • aneov_governors_v001.zip
    75.5 KB · Views: 1,281
Last edited:

Venael

Senior Member
Feb 14, 2012
76
20
is there any chance to get this as a zip for cwm?


edit:yay! just put it manually into system/lib/modules and changed permissions and it works!:)
 
Last edited:

mpiekp

Senior Member
Mar 23, 2011
1,358
621
Working .62.


Could you also build an OC module please, that would be awesome.

Sent from my MT11i using Tapatalk
 

mpiekp

Senior Member
Mar 23, 2011
1,358
621
Sources from any custom kernel, just compile against stock.

Thank you

Sent from my MT11i using Tapatalk
 

shardul_seth

Senior Member
Jul 31, 2011
1,103
1,717
Intellidemand please!

Could you please make an intellidemand governor also..

Also please see these commits for some changes to smartass2 (more stable) and working lulzactive
 

alljokingaside

Senior Member
May 28, 2012
237
42
Zed's dead. but no matter

OK- so I'm planning on installing the module on a different device. with the assumption that the smartassv2.ko drivers are all the same, i figure that only the specifics differ.

e.g. no /sys/lib folder exists in my system, though a /sys/modules folder does.

So, the plan is: i edit the script to point towards the valid directories; place the files in those noted directories (eg create a /sys/lib/modules folder); edit the "scanning_available_governors" to mention those governors; kick back and enjoy.

two things concern me. First, I checked the symsearch.ko file found references to the kallsyms, as well as to the general public license and ARMv7, but haven't found much info online as to what the driver does. since it mentions architecture that may or may not adhere to my device (samsung galaxy player 5),should I go ahead?

Second, OP mentioned:

"result should be as follows:
Code:
80101aec T module_kallsyms_lookup_name
801056f0 T kallsyms_lookup_name
Bolded value (801056f0) is address which we need."

the instructions following that line doesn't mention the kallsyms_lookup_name addy again. so what is the addy good for?

thanks!
 

martirio3000

Senior Member
Apr 19, 2012
379
80
Wow IT REALLY WORKED.
i have smartass V2 on My locked bootloader :).
Thank you.
(Yes i know i am a gravedigger but more people have to see this.)
Just everyday i find one more reason for not to unlock my BL.
I have the best governor
Best tweaks.
OC is useless (it consumes battery and Destroyes the phone).
WHY THE HECK WOULD I WANT A CUSTOM ROM.
EDIT: Erm guys how do i install it with hw_config.sh
 
Last edited:

bigburpsx3

Senior Member
Dec 31, 2011
89
3
It may be a silly question, but after reading descriptions to both the badass and the smartass v2 governors, but I'm still not quite sure which one will provide better battery life overall.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 7
    This modules are for people with stock kernels because they don't have 'smartass' or ondemandX' governors.

    EASY ENGLISH:
    Differences between this modules and build in stock kernels:
    - allows to set max CPU freq when screen is off (to save battery),
    - allows to set starting CPU freq when phone awakes (to speed up awake process),
    - allows set/change almost all aspects of governor (to suite needs),
    - should be a bit more responsive when parameters are well chosen for smartassv2 governor.

    Each governor has some predefinied values - more info in "Available settings".

    If governors works or not on other version then 4.0.2.A.0.42 let me know.

    Start:
    The goal was bring 'smartassv2' and 'ondemandX' governor to work with stock kernel on Neo V.

    Most information is in my thread on 'XPERIA X8 Android Development': [Module] | X8 | X10 mini/pro | AX8_SMARTASS v002 | 'smartass' governor | [2011-07-19]

    To remind:
    SmartassV2 (informal description and comparison with the first smartass)

    SmartassV2 is a governor (controls the frequency of the CPU at each give moment) which like the first smartass is generally based on the implementation of interactive with some major changes and the addition of a built in sleep profile (behaves a bit differently when screen is off vs. on).

    The smartassV2 improves the very naive scheme which the first smartass had: The first smartass (with the values I set for the hero), would cap the max frequency at 352Mhz for sleep and when screen is on, would do the opposite and keep the frequency at 518Mhz or above. For sleep this was very effective but a bit crude and unclean, and there could be some cases where you would need processing power even when screen is off (something is updating and music is playing and etc.). For screen on, smartass1 was too quick to jump to the max available frequency and again would never go below the 518Mhz, so in a nutshell its was using "too high" frequencies.

    SmartassV2, introduce (internally) an "ideal" frequency which is the frequency we are "aiming" for, in some sense. The way I see it is that the "ideal" frequency is a hint to the governor what is a good balance between performance and battery life. Now when screen is on, I set (on the hero) the ideal frequency to 518Mhz which will ensure nice responsiveness but limit unnecessary use of higher frequencies when they are not needed. When screen is off, I set the ideal frequency to 352Mhz (0 will disable the screen state tracking all together). From my testing this will "convince" the governor to spend most of the its time during sleep at the lowest available frequencies. Note, that both during sleep and when awake the entire frequency range (as defined by the "user" - i.e. selected with SetCPU) is used by smartassV2. For example, when the CPU is loaded heavily, the highest available frequency will be used regardless if screen is on or off.

    ondemandX - ondemand governor code from latest linux (3.0 at the moment) source *plus* the suspend/wake logic described above. No further optimization is done.

    Info:
    - information about governors is here,
    - more information about 'smartass' governor is here or here,
    - how different governors work is explained here: [Q] SetCPU governors (explained).


    Prerequisites:
    - Neo V (if works on Neo - let me know),
    - root,
    - ondemandX should work on any version,
    - smartass was compiled against 4.0.2.A.0.42 version, how run on other version will be explained in manuall installation section,
    - desire to replace SetCPU - when used only for 'ScreenOff' profile.

    Manual installation:
    1. Unzip file
    2. Run copy.cmd file - this should copy modules to /system/lib/modules
    3. run adb shell or terminal - whatever you like and execute su
      Code:
      su
    4. If you have 4.0.2.A.0.42 version proceed to step 6
    5. For smartass governor you need to know address for 'kallsyms_lookup_name'
      run following command:
      Code:
      cat /proc/kallsyms | grep kallsyms_lookup_name
      result should be as follows:
      Code:
      80101aec T module_kallsyms_lookup_name
      [SIZE="3"][B]801056f0[/B][/SIZE] T kallsyms_lookup_name
      Bolded value (801056f0) is address which we need.
    6. Optional step: lower min CPU freq:
      Code:
      echo 122880 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
    7. Insert ondemandX module:
      Code:
      insmod /system/lib/modules/aneov_ondemandx.ko
      in dmesg command should be line:
      Code:
      <6>[  431.711517] aneov_ondemandX: module v001 for device Xperia Neo V loaded
    8. Insert smartassV2 module:
      • for version 4.0.2.A.0.42 just run command:
        Code:
        insmod /system/lib/modules/aneov_smartass2.ko
        in dmesg command should be line:
        Code:
        <6>[  420.308380] aneov_smartass2: module v001 for device Xperia Neo V loaded
      • for other use 'address' and use following command:
        Code:
        insmod /system/lib/modules/aneov_smartass2.ko lookup_address=0x[B][COLOR="Red"]801056f0[/COLOR][/B]
        in dmesg command should be line:
        Code:
        <6>[  420.308380] aneov_smartass2: module v001 for device Xperia Neo V loaded
    9. Now you can enable desired governor. Execute:
      Code:
      echo "smartassV2" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    for smartassV2 or
    Code:
    echo "ondemandX" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    for ondemandX governor.

    Lower min cpu freq a bit:
    Code:
    echo 122880 >  /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

    Until you're sure that it works with your hardware, don't install it to hw_config.sh.

    Available settings:
    Will be added later

    v001:
    - just initial version fixed to work with Neo V.

    Disclaimer
    I'm not responsible if this module damages your lovely phone. Use it at your own risk! Think before you do something!

    Sources at: GitHub
    1
    Working .62.


    Could you also build an OC module please, that would be awesome.

    Sent from my MT11i using Tapatalk

    If I find source somewhere - or someone point me to sources - I can try.
    1
    not working on miui 2.7.13 based on 4.0.4