(This is a resend of a message I sent last week, but I wasn't subscribed to the list at the time so it ended up in list moderator approval land. Apologies in advance if the original message does eventually show up as a duplicate, but I suspect they are buried in a bucket of endless spam and will never be heard from again...) We noticed serious latency issues when performing NAND I/O on our embedded target with a non-preemptive kernel -- on the order of hundreds of milliseconds during heavy I/O. Of course enabling kernel preemption would fix this but that had other undesirable effects. Adding cond_resched() to strategic places in both the MTD code and yaffs code has reduced the latency to acceptable levels for us, here is the yaffs part of the patch if anybody is interested. --- yaffs2-20081017/yaffs_guts.c 2008-07-20 21:03:19.000000000 -0400 +++ yaffs2-20081017-patched/yaffs_guts.c 2008-10-28 14:50:00.000000000 -0400 @@ -714,6 +714,7 @@ } } } + YYIELD(); } @@ -3141,6 +3142,7 @@ yaffs_DeleteChunk(dev, oldChunk, markNAND, __LINE__); } + YYIELD(); } yaffs_ReleaseTempBuffer(dev, buffer, __LINE__); @@ -3247,6 +3249,7 @@ ("yaffs: GC !!!no reclaim!!! erasedBlocks %d after try %d block %d" TENDSTR), dev->nErasedBlocks, maxTries, block)); } + YYIELD(); } while ((dev->nErasedBlocks < dev->nReservedBlocks) && (block > 0) && (maxTries < 2)); @@ -3889,6 +3892,7 @@ cache->dirty = 0; cache->object = NULL; } + YYIELD(); } while (cache && chunkWritten > 0); @@ -3926,6 +3930,7 @@ } if(obj) yaffs_FlushFilesChunkCache(obj); + YYIELD(); } while(obj); @@ -4780,6 +4785,7 @@ buffer += nToCopy; nDone += nToCopy; + YYIELD(); } return nDone; @@ -4965,6 +4971,7 @@ buffer += nToCopy; nDone += nToCopy; } + YYIELD(); }