mmcsd on RPi
George Mitchell
george+freebsd at m5p.com
Sat Sep 7 16:31:49 UTC 2013
On 09/07/13 10:40, Ian Lepore wrote:
> On Sat, 2013-09-07 at 10:19 -0400, George Mitchell wrote:
>> While performing "disk" operations in the process of building ports on
>> my Raspberry Pi, I observe idle times in the 80-98% range, with the
>> processes doing the work in the biowr or biord states in the "top"
>> display. Interrupt time varies from 1-8% with system time in the 1-3%
>> range. Could this be due to my having a crappy SD card, or is it
>> inherent in the current mmcsd driver on ARM? Is there anything I can
>> do to help speed up the driver?
>>
>> My continuing thanks go to the many developers on the ARM project, and
>> especially the ones who have made the Raspberry Pi a viable FreeBSD
>> platform. -- George
>
> The sd driver on the rpi is in pretty good shape -- it does multi-block
> IO and uses DMA. A different card may perform better. Counter-
> intuitively, an older/smaller card may be better than the very latest.
>
> Random small writes are the worst-case scenario for sd cards, it drives
> them into doing a non-trivial amount of read-modify-write internally
> (writing anything from 1 sector to a 64k chunk can result in read,
> erase, rewrite of a much larger block, often in the megabytes). Newer
> cards tend to be optimized for the way cameras and hd-cams write data to
> a fat32 filesystem. That optimization doesn't do our ufs filesystems
> any favors.
>
> It's not unusual when running gstat against an sd device to see IO times
> averaging multiple seconds per write transaction. It's really taking
> dozens of milliseconds per individual write, and then the system's bio
> queue is so backed up that it takes 10 seconds or more to retire any
> given write. Reads also slow down when writes get backlogged, because
> the sdcard can only do one thing at a time.
>
> If you can arrange to have object files written to tmpfs during builds,
> that'll help a lot.
>
> -- Ian
>
Thanks for the explanation and the hint. -- George
More information about the freebsd-arm
mailing list