[U-Boot] EXT4 slow boot problem

Christophe Ronco c.ronco at kerlink.fr
Fri Oct 27 14:18:10 UTC 2017


Hi,

On Wed Oct 8 10:11:58 CEST 2014, Blair Pendleton sent following mail to the list:
We have discovered a significant performance problem in U-Boot accessing an EXT4 file system.
If a large image file happens to be created with more than 4 extents, file read time increases from a few seconds to several minutes.
The root cause is the indexed extent block is being re-read tens of thousands of times from the underlying device.

In our case, the image file is ~44MB and the underlying device is a MMC SD card.
Software updates are performed in Linux, and depending on a particular instance of EXT4 block allocations, the image file is created with 3, 4 or 5 extents.
With 3 or 4 extents (tree depth 0), file reads are fast because the extent records are located in the cached i-node and the entire file is read with 3 or 4 large MMC block reads.
With 5 extents (tree depth 1), extent records are in a separate block referenced by an extent index node.
The current U-Boot implementation makes no attempt to cache this block and is forced to re-read it for every block of file data (EXT4 block size 1KB).
This results in excess of 43000 MMC read operations and boot times so long that the system appears to be hung.

Blair Pendleton
Fluke Networks R&D
Colorado Springs, CO, USA

I encountered the same problem on my board. My Linux Kernel is in an ext4 partition on eMMC. 
I usually read it in less than 1s. Trace example:
10870816 bytes read in 622 ms (16.7 MiB/s)
When I have the problem (kernel file in more than 4 extents), I read it in 30s to 35s. Trace example:
10876728 bytes read in 34035 ms (311.5 KiB/s)

I don't use an up-to-date U-Boot but I think this is not corrected in latest U-Boot. I made a patch that does not completely solve the problem but should fix performance problem in my case. 

It is not good enough for mainline but might help others if they encounter the same problem.

Problems I see in this patch:
 - there are still a useless zalloc/free in read_allocated_block (called for each block)
 - I don't know how many blocks should be cached. In my case I need only one block to be cached.
 - I have not tested this patch with more than one extent index block.

Best Regards,

Christophe

Christophe Ronco (1):
  ext4: cache first extent index blocks (#06343)

 fs/ext4/ext4_common.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++---
 fs/ext4/ext4_common.h | 16 +++++++++
 fs/ext4/ext4fs.c      | 16 +++++++--
 3 files changed, 117 insertions(+), 8 deletions(-)

-- 
2.7.4



More information about the U-Boot mailing list