Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 07 Sep 2013 08:40:36 -0600
From:      Ian Lepore <ian@FreeBSD.org>
To:        George Mitchell <george+freebsd@m5p.com>
Cc:        "freebsd-arm@freebsd.org" <freebsd-arm@FreeBSD.org>
Subject:   Re: mmcsd on RPi
Message-ID:  <1378564836.1111.506.camel@revolution.hippie.lan>
In-Reply-To: <522B35E9.2000002@m5p.com>
References:  <522B35E9.2000002@m5p.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1378564836.1111.506.camel>