The Following 93 Users Say Thank You to nightfire For This Useful Post: | ||
-L-, abill_uk, anapospastos, ArnimS, Arrancamos, attila77, Bartus, Benson, bobh, Bundyo, cddiede, ceevee, cfh11, Char, cheve, clasificado, corduroysack, Creamy Goodness, Dark_Angel85, debernardis, elie-7, Estel, EugeneS, ezmendriz, F2thaK, fasza2, fms, frostbyte, fusi, fw190, gabby131, Gucky66, HellFlyer, Helmuth, joerg_rw, juise-, jurop88, kevloral, kinggo, kmare, kopele, ktchiu, leetnoob, Lehto, lma, Manatus, Marshall Banana, MartinK, mathiasp, mece, mehulrajput, Mentalist Traceur, mikec, moepda, mpi, mrojas, mscion, nashith, Necc, OVK, pedrolucasbp, pelago, peterleinchen, pillar, qole, rabarkar, rebhana, reinob, RobbieThe1st, saned, sbock, scribbles, stlpaul, Stonik, stopgap, Switch_, theonelaw, Tiboric, tokag, trompkins, tswindell, uppercase, uvatbc, vdx29, Venemo, wumpwoast, Xagoln, ysss, Zaerc, zero, zillertal |
![]() |
2011-02-17
, 02:28
|
Posts: 1,463 |
Thanked: 1,916 times |
Joined on Feb 2008
@ Edmonton, AB
|
#2
|
![]() |
2011-02-17
, 03:12
|
Posts: 2,225 |
Thanked: 3,822 times |
Joined on Jun 2010
@ Florida
|
#3
|
The Following 4 Users Say Thank You to Mentalist Traceur For This Useful Post: | ||
![]() |
2011-02-17
, 03:15
|
Posts: 1,522 |
Thanked: 392 times |
Joined on Jul 2010
@ São Paulo, Brazil
|
#4
|
The Following 3 Users Say Thank You to TiagoTiago For This Useful Post: | ||
![]() |
2011-02-17
, 03:25
|
Posts: 310 |
Thanked: 383 times |
Joined on Jan 2010
|
#5
|
The Following User Says Thank You to nightfire For This Useful Post: | ||
![]() |
2011-02-17
, 03:45
|
Banned |
Posts: 358 |
Thanked: 160 times |
Joined on Dec 2010
|
#6
|
![]() |
2011-02-17
, 03:54
|
Posts: 310 |
Thanked: 383 times |
Joined on Jan 2010
|
#7
|
I've written tune-up tools. I've other parametres. U may find it interesting. What are the original values?
echo -n "dirty_ratio: " ; cat /proc/sys/vm/dirty_ratio echo -n "dirty_background_ratio: " ; cat /proc/sys/vm/dirty_background_ratio echo -n "dirty_writeback_centisecs: " ; cat /proc/sys/vm/dirty_writeback_centisecs echo -n "dirty_expire_centisecs: " ; cat /proc/sys/vm/dirty_expire_centisecs echo -n "min_free_kbytes: " ; cat /proc/sys/vm/min_free_kbytes echo -n "swappiness: " ; cat /proc/sys/vm/swappiness echo -n "vfs_cache_pressure: " ; cat /proc/sys/vm/vfs_cache_pressure echo -n "onboard_nr_requests: " ; cat /sys/block/mmcblk0/queue/nr_requests echo -n "sd_nr_requests: " ; cat /sys/block/mmcblk1/queue/nr_requests
![]() |
2011-02-17
, 04:00
|
Banned |
Posts: 358 |
Thanked: 160 times |
Joined on Dec 2010
|
#8
|
![]() |
2011-02-17
, 04:02
|
Posts: 2,014 |
Thanked: 1,581 times |
Joined on Sep 2009
|
#9
|
dirty_ratio: 95 dirty_background_ratio: 60 dirty_writeback_centisecs: 0 dirty_expire_centisecs: 0 min_free_kbytes: 2039 swappiness: 30 vfs_cache_pressure: 100 onboard_nr_requests: 128 sd_nr_requests: 128
![]() |
2011-02-17
, 04:06
|
Posts: 310 |
Thanked: 383 times |
Joined on Jan 2010
|
#10
|
I've been using my phone as a wireless media server for friends (with Samba + wifi hotspot). While it worked brilliantly for reads, writes were causing all kinds of weird issues, and absolutely destroyed interactivity on the phone itself.
Later, while copying several 400mb files from internal storage to my SD card, it actually froze, and rebooted. I suspect dsme was swapped out and couldn't respond quickly enough to avoid the watchdog.
Anyway, I sat down and thought about the problem, and set about to improve interactivity under I/O load. This is my current configuration, and I find it vastly improves responsiveness:
Generally speaking, Linux is tuned for rotating media, not flash memory. The VM and I/O schedulers try to group I/Os together in a sensible manner, to reduce disk thrashing.
Of course, it's meaningless on the n900; there is no penalty for discontinous I/O.
So what I've done is:
- Reduce the time dirty buffers and pages are allowed to remain dirty; they should be eligible for flushing almost immediately.
- Reduce the amount of VM allowed to stay dirty; I/Os block once this threshold is met.
- Increase the minimum amount of free physical memory. The kernel will always try to leave 4mb free (yes, wasted) so that large allocations can take place even under high memory pressure (without swapping). When used, the kernel prioritizes its replacement by freeing other memory (through swapping or flushing writes).
- Reduce the willingness of the system to needlessly swap. This one is somewhat contentious (no pun intended); if your phone doesn't favor maintaining cache and free memory, swap-outs can be exceptionally long, when required, to make room for things like the Phone app. However, due to the overall improvement in interactivity, I find it acceptable. I've never come close to missing a call.
- Prefer to free disk cache over program data. The onboard storage (and even microsd) is quite fast for reads, and has no rotational latency. Since we're almost always under pressure for RAM, let's prefer to keep data we know we'll need over VFS cache. Helps to prevent large files (ie. videos) from overwhelming program data.
- Set the swap page size to 256k to match the SD card or internal flash device.
- .. and finally:
The most important change was reducing (essentially eliminating) the device I/O queues. The main purpose of I/O queueing is to allow the system to make intelligent read/write decisions based on a large number of elements requested (nearly) concurrently, such as contiguous streaming of data collected across multiple writes.
This doesn't really provide any benefit for us though! There is no additional latency associated with discontinuous writes, so why let the I/O queues build up?
Reducing them to 4 causes I/Os to block, rather than queue. This means you're less likely to encounter a situation where the queue is slammed by a large background process (ie. copying a 400mb file), and something you do in the foreground requires immediate I/O to continue, because the longest you'll have to wait is 4 I/Os!
Anyway, if you want to give it a try, just paste those commands into your terminal as root.
I'd advise against making them permanent until more people try it out.
And if you're a VFS maintainer and notice an error in my logic please point it out as well!
Last edited by nightfire; 2011-02-17 at 16:07.