[Hero, G2 Touch Android Development] MaXo64:
hi guys .. I've found a way to tune the Linux IO scheduler for flash drives. which is both ROM and SD in our phones case..

Linux have 4 I/O schedulers:

- No-op Scheduler

- Anticipatory IO Scheduler (AS)

- Deadline Scheduler

- Complete Fair Queueing Scheduler (CFQ)

the default is "CFQ", which brings great performance for "Magnetic Disks drives". but not for Flash drives.

in the ".config" file of Android kernel source I noticed that "Deadline" is set as default. but it's not the fastest for Flash drives.

here are some benchmarks I found which is done on a 1 GB flash drive connected on Debian:

root@galileo:/media/vfat# cat /sys/block/sdb/queue/scheduler
noop anticipatory deadline [cfq]
root@galileo:/media/vfat# postmark
PostMark v1.51 : 8/14/01
pm>set size 500 500000
pm>set subdirectories 1000
pm>run
Creating subdirectories...Done
Creating files...Done
Performing transactions..........Done
Deleting files...Done
Deleting subdirectories...Done
Time:
351 seconds total
160 seconds of transactions (3 per second)

Files:
757 created (2 per second)
Creation alone: 500 files (55 per second)
Mixed with transactions: 257 files (1 per second)
257 read (1 per second)
243 appended (1 per second)
757 deleted (2 per second)
Deletion alone: 514 files (2 per second)
Mixed with transactions: 243 files (1 per second)

Data:
69.80 megabytes read (203.62 kilobytes per second)
208.94 megabytes written (609.56 kilobytes per second)
pm>exit

root@galileo:/media/vfat# echo noop > /sys/block/sdb/queue/scheduler
root@galileo:/media/vfat# cat /sys/block/sdb/queue/scheduler
[noop] anticipatory deadline cfq
root@galileo:/media/vfat# postmark
PostMark v1.51 : 8/14/01
pm>set size 500 500000
pm>set subdirectories 1000
pm>run
Creating subdirectories...Done
Creating files...Done
Performing transactions..........Done
Deleting files...Done
Deleting subdirectories...Done
Time:
147 seconds total
1 seconds of transactions (500 per second)

Files:
757 created (5 per second)
Creation alone: 500 files (3 per second)
Mixed with transactions: 257 files (257 per second)
257 read (257 per second)
243 appended (243 per second)
757 deleted (5 per second)
Deletion alone: 514 files (514 per second)
Mixed with transactions: 243 files (243 per second)

Data:
69.80 megabytes read (486.20 kilobytes per second)
208.94 megabytes written (1.42 megabytes per second)
pm>exit

root@galileo:/media/vfat# echo deadline > /sys/block/sdb/queue/scheduler
root@galileo:/media/vfat# cat /sys/block/sdb/queue/scheduler
noop anticipatory [deadline] cfq
root@galileo:/media/vfat# postmark
PostMark v1.51 : 8/14/01
pm>set size 500 500000
pm>set subdirectories 1000
pm>run
Creating subdirectories...Done
Creating files...Done
Performing transactions..........Done
Deleting files...Done
Deleting subdirectories...Done
Time:
279 seconds total
250 seconds of transactions (2 per second)

Files:
757 created (2 per second)
Creation alone: 500 files (17 per second)
Mixed with transactions: 257 files (1 per second)
257 read (1 per second)
243 appended (0 per second)
757 deleted (2 per second)
Deletion alone: 514 files (514 per second)
Mixed with transactions: 243 files (0 per second)

Data:
69.80 megabytes read (256.17 kilobytes per second)
208.94 megabytes written (766.86 kilobytes per second)
pm>exit

root@galileo:/media/vfat# echo anticipatory
> /sys/block/sdb/queue/scheduler
root@galileo:/media/vfat# cat /sys/block/sdb/queue/scheduler
noop [anticipatory] deadline cfq
root@galileo:/media/vfat# postmark
PostMark v1.51 : 8/14/01
pm>set size 500 500000
pm>set subdirectories 1000
pm>run
Creating subdirectories...Done
Creating files...Done
Performing transactions..........Done
Deleting files...Done
Deleting subdirectories...Done
Time:
266 seconds total
131 seconds of transactions (3 per second)

Files:
757 created (2 per second)
Creation alone: 500 files (166 per second)
Mixed with transactions: 257 files (1 per second)
257 read (1 per second)
243 appended (1 per second)
757 deleted (2 per second)
Deletion alone: 514 files (3 per second)
Mixed with transactions: 243 files (1 per second)

Data:
69.80 megabytes read (268.69 kilobytes per second)
208.94 megabytes written (804.34 kilobytes per second)
pm>exit

Src: http://www.debianhelp.org/node/9148

summary: (less is better)

1) NOOP 147 sec

2) Anticipatory 266 sec

3) Deadline 279 sec

4) CFQ 351 sec

I've made and attached a shell script to set NOOP as default. to install unzip file to your home folder and do this in a terminal:

adb push 11iosched /system/etc/init.d
adb shell chmod 655 /system/etc/init.d/11iosched
adb shell sh /system/etc/init.d/11iosched

and if you have a kernel source, and want the kernel to use NOOP as default always, open .config file and change to this settings:

#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y
# CONFIG_IOSCHED_CFQ is not set
# CONFIG_DEFAULT_AS is not set
# CONFIG_DEFAULT_DEADLINE=y
# CONFIG_DEFAULT_CFQ is not set
CONFIG_DEFAULT_NOOP=y
CONFIG_DEFAULT_IOSCHED="noop"
CONFIG_FREEZER=y

i'm using my ROM Fallah 1.4 on my phone and for the first time Softweg filesystem benchmarks reached 37. before I hardly get 31.

to check if it's working, do this:

adb shell
cat /sys/block/*/queue/scheduler

you should see something like this

the [] brackets shows the selected scheduler..

enjoy :cool: