Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
Cilraaz
Old
(Last edited by Cilraaz; 19th November 2011 at 03:38 AM.)
#1  
Senior Member - OP
Thanks Meter 185
Posts: 486
Join Date: Sep 2010
Default [SCRIPT] I/O Scheduler Changer

While spending some time in the Humble ROM thread, the discussion had turned toward changing the phone's I/O Scheduler to improve performance. Some people stated they had used Tegrak to execute the change. Since I personally don't overclock my phone, I decided that paying for Tegrak wasn't worth it to me just for the I/O Scheduler tweak. As such, I wrote a little bash script to handle the change for me.

The script deals only with the five blocks that pertain to the Droid Charge: stl9, stl10, stl11, mmcblk0, and mmcblk1. It also only deals with three scheduler types: noop, deadline, and cfq. These were the only scheduler options available on my phone. Let me know if you have other schedulers available, and I can look into adding them. Also, if you have some reason that another block should be added, let me know what block and why.

Installation / Use - Root access is required!
1. Place the script in the location of your choosing, most likely on your SDCard, and remove the .txt from the end of the file name
2. Run the script via command line or the Script Manager app (it must be run as root!)
3. The script will show you the phone's current I/O Scheduler settings
4. The script will prompt you to choose a new I/O Scheduler setting
5. After you make a selection, the script will create a secondary script, /data/99CilSchedChanger.sh, which is the script that actually makes the scheduler change. If the script already exists (any time after the initial running of the script, for example), it will be recreated
6. The script will then run /data/99CilSchedChanger.sh to make the change and display the results
7. (optional) Set /data/99CilSchedChanger.sh to run on boot, which can be done with either the Script Manager app or by soft-linking it to your init.d directory (if your ROM allows init.d usage)

Note: To access 99CilSchedChanger.sh within /data, you will need to set Script Manager to browse as root. You can do so by doing the following:
1. Press the menu button
2. Select Browse
3. Press the menu button
4. Select More
5. Select Advanced options
6. Select Config
7. Check "Browse as Root"

Known Issues
None.

FAQ
What is an I/O Scheduler?
An I/O (input/output) scheduler exists to prioritize requests to storage. Its main purpose is to increase read/write performance.
Why would I want to change my I/O Scheduler?
The default I/O Scheduler on the Droid Charge is cfq. This stands for Completely Fair Queuing. Cfq was created to prioritize I/O requests in a way that minimizes the distance that a hard drive's head needs to move. As such, it speeds up all of the requests, since it's not moving the hard drive's head from one end of the drive to the other and back. There's just one problem... our phones use flash memory, which have no physically moving parts. This means that cfq is not necessarily the best scheduler for our purposes.
What are "noop" and "deadline"?
The noop and deadline schedulers have been shown to improve performance on our phones. Noop is pretty much what is says: no operation. It doesn't use any algorithm to prioritize I/O requests. It's pretty much first come, first served. Deadline is a scheduler that places a, well, deadline on I/O requests. This essentially tells the scheduler that this I/O request needs to be fulfilled by 'x' time. This can prevent one process from monopolizing I/O.
Which scheduler is the best for my phone?
Most discussion has shown that both noop and deadline give better performance than cfq. Which of the two is better, though, is up for debate. Try both and see which feels snappier to you!
Do I need to reboot after changing my I/O Scheduler?
No. Changes are made dynamically and a reboot is not required.
What if I want to go back to default/uninstall?
If you want to go back to default, simply run the script again and choose the option for cfq. This is the default I/O Scheduler for the Droid Charge, so choosing that option will make your phone as if the script was never run. If you want to uninstall the script, simply delete /data/99CilSchedChanger.sh and CilSchedChngCtrl.sh (from wherever you placed it).

Changelog
Version 2
  • Code cleanup and commenting is done: The code is now consistant on whether or not to use an end-of-line semi-colon, all code blocks are commented properly, and variables are unset when no longer needed
  • Code comments header was added. This includes version number, link to this thread, and author information
  • Before and after displays were changed to parse out only the currently used scheduler (rather than showing the raw output, as the last version did)
  • The menu system was completely re-written to be dynamic. If you happen to somehow have a scheduler other than cfq, noop, or deadline, then it should be added to the menu. Note: the script pulls the potential menu options from block stl10 (/system)
  • /data/99CilSchedChanger.sh is now re-written every time the control script is run, rather than just modifying the default. This should make future releases "cleaner", rather than requiring the end-user to delete /data/99CilSchedChanger.sh. The resource cost is minimal
  • /data/99CilSchedChanger.sh can be called directly with a command line option of a scheduler type (for instance, "/data/99CilSchedChanger.sh noop"). This was possible before, but has now been made dynamic. When the control script is run, all possible schedulers are dumped into /data/99CilSchedChanger.sh to be checked against the command line option. This is an entirely optional way to run the script
Version 1
  • Initial Release

Have questions? Post them here and I'll do my best to answer them.
Attached Files
File Type: txt CilSchedChngCtrl.sh.txt - [Click for QR Code] (1.7 KB, 323 views)
File Type: txt CilSchedChngCtrl-v2-fixed.sh.txt - [Click for QR Code] (2.9 KB, 1222 views)
The Following 8 Users Say Thank You to Cilraaz For This Useful Post: [ Click to Expand ]
 
usererror404
Old
#2  
Member
Thanks Meter 34
Posts: 49
Join Date: Sep 2011
Location: Wilmington, NC
No dice. Damn, I was really hoping it would work. I get the following:
Code:
: not found
Current I/O Schedulers
: not found
/mnt/sdcard/download/CilSchedChmgCtrl.sh.txt: 8:
Syntax error: word unexpected
Running Humble 5 RC2, used Script Manager, running as root, running script as root.
 
Cilraaz
Old
#3  
Senior Member - OP
Thanks Meter 185
Posts: 486
Join Date: Sep 2010
Step 1... Remove .txt from the end of the script.

It's also "CilSchedChngCtrl.sh", not "CilSchedChmgCtrl.sh", unless you renamed it for some reason.
 
usererror404
Old
#4  
Member
Thanks Meter 34
Posts: 49
Join Date: Sep 2011
Location: Wilmington, NC
Thanks. That's what it's listed here as.

---------- Post added at 02:36 PM ---------- Previous post was at 02:28 PM ----------

removed the .txt, same result.
 
Kenbals
Old
#5  
Kenbals's Avatar
Member
Thanks Meter 21
Posts: 83
Join Date: Nov 2011
I'm running humble 5.0. Can I use tegrak or is this my only option? Market shows the kernal and overclock are free for tegrak.. ??

Sent from my SCH-I510 using XDA App
 
Cilraaz
Old
#6  
Senior Member - OP
Thanks Meter 185
Posts: 486
Join Date: Sep 2010
Quote:
Originally Posted by usererror404 View Post
Thanks. That's what it's listed here as.

---------- Post added at 02:36 PM ---------- Previous post was at 02:28 PM ----------

removed the .txt, same result.
Let me try reloading busybox 1.18.4. I downgrade to 1.18.2 when I load ROMs, as higher versions have issues with the V6 script. I'll edit this post to see if that's the problem. If it is, I'll add it to the known issues list.

Quote:
Originally Posted by Kenbals View Post
I'm running humble 5.0. Can I use tegrak or is this my only option? Market shows the kernal and overclock are free for tegrak.. ??

Sent from my SCH-I510 using XDA App
You can use tegrak. Tegrak won't load on boot without using the paid version, though, which is why I created this script.
 
burningembers
Old
#7  
Senior Member
Thanks Meter 31
Posts: 242
Join Date: Sep 2010
Quote:
Originally Posted by usererror404 View Post
No dice. Damn, I was really hoping it would work. I get the following:
Code:
: not found
Current I/O Schedulers
: not found
/mnt/sdcard/download/CilSchedChmgCtrl.sh.txt: 8:
Syntax error: word unexpected
Running Humble 5 RC2, used Script Manager, running as root, running script as root.
Getting the same errors here both via Terminal and via Script Manager. As root, and .txt removed from the filename.

Running Humble 5 RC2, BusyBox v1.19, SU Binary 3.0.3
 
911junkie
Old
#8  
Member
Thanks Meter 1
Posts: 50
Join Date: Aug 2010
Is there a method to remove if we don't like what we see? How would we go back to stock?
 
blckngldhwk
Old
#9  
Senior Member
Thanks Meter 32
Posts: 229
Join Date: Jan 2011
: not found
Cilraaz's Scheduler Changer
by Cilraaz of XDA-Developers Forums
: not found
Current I/O Schedulers
: not found
/sdcard/tapatalkxda_download/CilSchedChngCtrl.sh: 8: Syntax error: word unexpected

Sent from my SCH-I510 using XDA App
 
ffd173
Old
#10  
Senior Member
Thanks Meter 8
Posts: 101
Join Date: May 2011
Quote:
Originally Posted by usererror404 View Post
No dice. Damn, I was really hoping it would work. I get the following:
Code:
: not found
Current I/O Schedulers
: not found
/mnt/sdcard/download/CilSchedChmgCtrl.sh.txt: 8:
Syntax error: word unexpected
Running Humble 5 RC2, used Script Manager, running as root, running script as root.
Same result here. I'd really like to try this also. I'm sure it's only a small issue.

 
Post Reply+
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

report this ad
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Go to top of page...