Announcement

Collapse
No announcement yet.

Announcement

Collapse
No announcement yet.

init.d script to tweak interactive governor and deadline scheduler for NX785QC8G

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    init.d script to tweak interactive governor and deadline scheduler for NX785QC8G

    ONLY FOR NX785QC8G!!

    I wrote this init.d script to tweak the default values of the interactive governor and switch to a tweaked deadline io scheduler. seems to improve responsiveness quite a bit, and battery life is good too. I'm at 34% batt right now with 5 hours screen on time and constant WiFi use. YMMV but feel free to try it for yourself! just place this file in /etc/init.d and change owner and group to root, then chmod 755. here is the code, script file is attached - DON'T FORGET TO REMOVE THE .TXT EXTENSION!!

    Code:
    #!/system/bin/sh
    
    
    echo "deadline" > /sys/block/mmcblk0/queue/scheduler
    chmod 444 /sys/block/mmcblk0/queue/scheduler
    
    
    echo "1" > /sys/block/mmcblk0/queue/add_random
    chmod 444 /sys/block/mmcblk0/queue/add_random
    echo "1" > /sys/block/mmcblk0/queue/iostats
    chmod 444 /sys/block/mmcblk0/queue/iostats
    echo "0" > /sys/block/mmcblk0/queue/nomerges
    chmod 444 /sys/block/mmcblk0/queue/nomerges
    echo "0" > /sys/block/mmcblk0/queue/rotational
    chmod 444 /sys/block/mmcblk0/queue/rotational
    echo "1" > /sys/block/mmcblk0/queue/rq_affinity
    chmod 444 /sys/block/mmcblk0/queue/rq_affinity
    
    
    echo "4" > /sys/block/mmcblk0/queue/iosched/fifo_batch
    chmod 444 /sys/block/mmcblk0/queue/iosched/fifo_batch
    echo "1" > /sys/block/mmcblk0/queue/iosched/front_merges
    chmod 444 /sys/block/mmcblk0/queue/iosched/front_merges
    echo "500" > /sys/block/mmcblk0/queue/iosched/read_expire
    chmod 444 /sys/block/mmcblk0/queue/iosched/read_expire
    echo "3000" > /sys/block/mmcblk0/queue/iosched/write_expire
    chmod 444 /sys/block/mmcblk0/queue/iosched/write_expire
    echo "3" > /sys/block/mmcblk0/queue/iosched/writes_starved
    chmod 444 /sys/block/mmcblk0/queue/iosched/writes_starved
    
    
    echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    chmod 444 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    
    
    echo "15000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
    chmod 444 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
    echo "0" > /sys/devices/system/cpu/cpufreq/interactive/boost
    chmod 444 /sys/devices/system/cpu/cpufreq/interactive/boost
    echo "60000" > /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
    chmod 444 /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
    echo "70" > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
    chmod 444 /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
    echo "1200000" > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
    chmod 444 /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
    echo "60000" > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
    chmod 444 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
    echo "90" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
    chmod 444 /sys/devices/system/cpu/cpufreq/interactive/target_loads
    echo "15000" > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
    chmod 444 /sys/devices/system/cpu/cpufreq/interactive/timer_rate
    echo "60000" > /sys/devices/system/cpu/cpufreq/interactive/timer_slack
    chmod 444 /sys/devices/system/cpu/cpufreq/interactive/timer_slack
    Attached Files

    #2
    here is screenshot:
    Click image for larger version

Name:	Screenshot_2014-11-23-20-49-24.png
Views:	1
Size:	72.5 KB
ID:	435382

    Click image for larger version

Name:	Screenshot_2014-11-23-20-52-27.png
Views:	1
Size:	67.6 KB
ID:	435383

    Comment


      #3
      So this is another way of fixing that battery issue that doesn't require opening it?

      Comment


        #4
        Originally posted by Darkomega View Post
        So this is another way of fixing that battery issue that doesn't require opening it?
        no, this has nothing to do with the battery issues. it'll just make your tablet feel snappier

        Comment


          #5
          I've actually updated this, this second script adds swap.

          Code:
          #!/system/bin/sh
          
          
          echo "128" > /proc/sys/kernel/random/read_wakeup_threshold
          echo "256" > /proc/sys/kernel/random/write_wakeup_threshold
          
          
          echo "50" > /proc/sys/vm/vfs_cache_pressure
          echo "90" > /proc/sys/vm/dirty_ratio
          echo "70" > /proc/sys/vm/dirty_background_ratio
          echo "500" > /proc/sys/vm/dirty_expire_centisecs
          echo "1000" > /proc/sys/vm/dirty_writeback_centisecs
          
          
          echo "512" > /sys/block/mmcblk0/queue/read_ahead_kb
          chmod 444 /sys/block/mmcblk0/queue/read_ahead_kb
          
          
          echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
          chmod 444 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
          
          
          echo "15000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
          chmod 444 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
          echo "0" > /sys/devices/system/cpu/cpufreq/interactive/boost
          chmod 444 /sys/devices/system/cpu/cpufreq/interactive/boost
          echo "60000" > /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
          chmod 444 /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
          echo "70" > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
          chmod 444 /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
          echo "1200000" > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
          chmod 444 /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
          echo "60000" > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
          chmod 444 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
          echo "90" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
          chmod 444 /sys/devices/system/cpu/cpufreq/interactive/target_loads
          echo "15000" > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
          chmod 444 /sys/devices/system/cpu/cpufreq/interactive/timer_rate
          echo "60000" > /sys/devices/system/cpu/cpufreq/interactive/timer_slack
          chmod 444 /sys/devices/system/cpu/cpufreq/interactive/timer_slack
          
          
          echo $((1024*1024*64)) > /sys/block/zram0/disksize
          mkswap /dev/block/zram0
          swapon /dev/block/zram0

          Comment


            #6
            Re: init.d script to tweak interactive governor and deadline scheduler for NX785QC8G

            I notice the second script doesn't include the scheduler tweaks. Should we only use one, or both scripts? I've been using the first one for a bit and liked it, I'm using the second one right now and it isn't quite as responsive. I'm wondering if this is the activation of zram, or lack of scheduler tweaking? Thanks!

            Comment


              #7
              Originally posted by Exile1975 View Post
              I notice the second script doesn't include the scheduler tweaks. Should we only use one, or both scripts? I've been using the first one for a bit and liked it, I'm using the second one right now and it isn't quite as responsive. I'm wondering if this is the activation of zram, or lack of scheduler tweaking? Thanks!
              only use one or the other.. I was experiencing slowdowns while performing certain filesystem operations using the first script so I removed the scheduler tweaks, but my usage patterns may differ from yours so I would definitely use whichever one feels better to you. the only difference between the two is the zram, as you noted, and the second script also adds a few lines that change the frequency of writes committed to the flash (should reduce power consumption theoretically) as well as changes to the way entropy is generated, similar to sefix and lagfix I guess.

              I would not use both at once, but I did keep the different mods somewhat separated into their own blocks, so if you wanted to copy the scheduler code from the first script into the second, that would work. maybe try integrating the scheduler code from the first script into the second and then commenting out the zram lines and see if that works better for you. it all really depends on how you're using your tablet, this is just what feels best for my usage habits -- YMMV.

              I'd be happy to answer any questions you have along the way though!!

              Comment


                #8
                Re: init.d script to tweak interactive governor and deadline scheduler for NX785QC8G

                That's exactly what I decided to do after posting. I combined the two and I'll see how it runs for a little bit and report back. I suspect that the slowdowns you experienced might be from one of these two lines but I'll do a little research and experimentation and let you know if I find out anything.

                echo "1" > /sys/block/mmcblk0/queue/add_random

                echo "3" > /sys/block/mmcblk0/queue/iosched/writes_starved

                Comment


                  #9
                  Originally posted by Exile1975 View Post
                  That's exactly what I decided to do after posting. I combined the two and I'll see how it runs for a little bit and report back. I suspect that the slowdowns you experienced might be from one of these two lines but I'll do a little research and experimentation and let you know if I find out anything.

                  echo "1" > /sys/block/mmcblk0/queue/add_random

                  echo "3" > /sys/block/mmcblk0/queue/iosched/writes_starved
                  it may have been.. but the slowdowns were while I was torrenting and trying to make other modifications to the same filesystem, I think what was happening was too much priority was being given to the torrent client. switching back to cfq on that device seems to have alleviated the issue.

                  Comment


                    #10
                    How would i add this, i'm new to all this but can learn quick, thanks.

                    Comment

                    Working...
                    X