[Patch] fix MTD CFI/LPDDR flash driver huge latency bug

Andrew Morton akpm at linux-foundation.org
Fri Mar 12 17:23:44 EST 2010


On Sat, 06 Mar 2010 17:48:57 +0100
Stefani Seibold <stefani at seibold.net> wrote:

> This patch fix a huge latency problem in the MTD CFI and LPDDR flash
> drivers.
> 
> The use of a memcpy() during a spinlock operation will cause very long
> thread context switch delays if the flash chip bandwidth is low and the
> data to be copied large, because a spinlock will disable preemption.
> 
> For example: A flash with 6,5 MB/s bandwidth will cause under ubifs,
> which request sometimes 128 KB (the flash erase size), a preemption
> delay of 20 milliseconds. High priority threads will not be served
> during this time, regardless whether this threads access the flash or
> not. This behavior breaks real time.
> 
> The patch change all the use of spin_lock operations for xxxx->mutex
> into mutex operations, which is exact what the name says and means. 
> 
> There is no performance regression since the mutex is normally not
> acquired.

hm, big scary patch.  Are you sure this mutex is never taken from
atomic or irq contexts?  Is it ully tested with all relevant debug options
and lockdep enabled?





More information about the linux-mtd mailing list