intrinsyc software android on emmc optimizing for performance · android system . confidential...
TRANSCRIPT
![Page 1: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/1.jpg)
CONFIDENTIAL INFORMATION
Intrinsyc Software
Android on eMMC
Optimizing for Performance
Tom Foy
![Page 2: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/2.jpg)
2 CONFIDENTIAL INFORMATION
What is eMMC?
Solid state storage device on MMC bus
Chip on PCB
NAND flash based
![Page 3: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/3.jpg)
3 CONFIDENTIAL INFORMATION
Why eMMC matters
Popular on embedded devices
Cheap
Flexible
![Page 4: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/4.jpg)
4 CONFIDENTIAL INFORMATION
eMMC characteristics
Fast read access
Fast read seek times
Acceptable sequential write performance
Poor random write performance
![Page 5: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/5.jpg)
CONFIDENTIAL INFORMATION
MMC
Micro-Controller
Slower NAND Flash
(Erase Blocks)
Slower NAND Flash
(Erase Blocks)
Slower NAND Flash
(Erase Blocks)
Slower NAND Flash
(Erase Blocks)
SRAM
Fast Cache Flash
MMC
Bus
Inside
Firmware
![Page 6: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/6.jpg)
6 CONFIDENTIAL INFORMATION
Inside the eMMC
NAND flash arranged in pages
Controller with temporary storage
Wear levelling
Free space management
![Page 7: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/7.jpg)
7 CONFIDENTIAL INFORMATION
Discard
eMMC TRIM command
Tells controller what is free
TRIM blocks on format
![Page 8: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/8.jpg)
8 CONFIDENTIAL INFORMATION
eMMC scenarios
Tablets with lots of DRAM
Smartphones
LCD-based eReaders
Electronic Paper (eInk) eReaders
LCD-based navigation devices
Industrial devices, Loggers
![Page 9: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/9.jpg)
9 CONFIDENTIAL INFORMATION
DRAM is good
Alleviates write performance issues
Improves read times even further
Reduces NAND wear
![Page 10: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/10.jpg)
10 CONFIDENTIAL INFORMATION
Areas
User space
Filesystem type
Filesystem layout
IO Scheduler
Block IO & Cache
MMC bus driver
EMMC
MMC/Block Device
Block Device
IO Scheduler
Filesystem Filesystem
SQLite DalvikVM Webkit
![Page 11: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/11.jpg)
11 CONFIDENTIAL INFORMATION
Android challenges
Vendors claim mostly sequential reads/writes
Content Providers
SQLite activity
Many sync writes from userspace
![Page 12: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/12.jpg)
12 CONFIDENTIAL INFORMATION
Boot
Fixed battery
Clean shut-down
Warm reboots
IO scheduler
Android system
![Page 13: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/13.jpg)
13 CONFIDENTIAL INFORMATION
Plenty of RAM allows large block cache
Low memory killer
Tune flushing thresholds
Cache is king!
![Page 14: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/14.jpg)
14 CONFIDENTIAL INFORMATION
Filesystems
Focus on write performance
Tests run using fsbench (3.0 kernel, OMAP3 aka Nook Color)
EXT4, BTRFS,NILFS2
![Page 15: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/15.jpg)
15 CONFIDENTIAL INFORMATION
Benchmarks
![Page 16: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/16.jpg)
16 CONFIDENTIAL INFORMATION
![Page 17: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/17.jpg)
17 CONFIDENTIAL INFORMATION
![Page 18: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/18.jpg)
18 CONFIDENTIAL INFORMATION
![Page 19: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/19.jpg)
19 CONFIDENTIAL INFORMATION
![Page 20: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/20.jpg)
20 CONFIDENTIAL INFORMATION
EXT4 - a write
Journal write (usually ~16K)
inode update (usually 4K)
Data goes into page cache
![Page 21: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/21.jpg)
21 CONFIDENTIAL INFORMATION
EXT4 w/o journal
Not too dangerous on embedded systems with battery
Good performance due to improved sequentiality
![Page 22: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/22.jpg)
22 CONFIDENTIAL INFORMATION
BTRFS
If not using a lot of fsync/fdatasync
Great large write performance
Terrible on small/mediun sync writes
Good performance on multiple writes
![Page 23: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/23.jpg)
23 CONFIDENTIAL INFORMATION
NILFS2
Consistent performance
Potentially much faster if eMMC part has fast sequential performance
Should theoretically be the fastest :-)
![Page 24: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/24.jpg)
24 CONFIDENTIAL INFORMATION
EXT4 with journal
If journaling is needed, consider RAM journal device
Again RAM journal not as dangerous as you think
Better than BTRFS on small/medium sync writes
![Page 25: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/25.jpg)
25 CONFIDENTIAL INFORMATION
I/O schedulers
CFQ, noop, deadline
Results are similar within ~10% range
QOS considerations are more important than throughput
![Page 26: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/26.jpg)
26 CONFIDENTIAL INFORMATION
User space
Avoid synchronization on files
Avoid sync/fsync/fdatasync/etc
Avoid small writes to files, better to buffer
Don’t be afraid to read, be afraid to write!
![Page 27: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/27.jpg)
27 CONFIDENTIAL INFORMATION
Conclusion
EXT4 (discard, ram/no journal) is probably your best bet
Try out a couple of configurations for the eMMC you are targeting
Avoid writes! :-)
![Page 28: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/28.jpg)
28 CONFIDENTIAL INFORMATION
Questions?
![Page 29: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/29.jpg)
29 CONFIDENTIAL INFORMATION CONFIDENTIAL INFORMATION
Appendix
![Page 30: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/30.jpg)
30 CONFIDENTIAL INFORMATION
EXT4 with RAM journal
![Page 31: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/31.jpg)
31 CONFIDENTIAL INFORMATION
![Page 32: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/32.jpg)
32 CONFIDENTIAL INFORMATION
![Page 33: Intrinsyc Software Android on eMMC Optimizing for Performance · Android system . CONFIDENTIAL INFORMATION 13 Plenty of RAM allows large block cache Low memory killer Tune flushing](https://reader035.vdocuments.net/reader035/viewer/2022071000/5fbc8b728648925bec0d94a6/html5/thumbnails/33.jpg)
33 CONFIDENTIAL INFORMATION