<div class="gmail_quote">On Tue, May 11, 2010 at 12:47 AM, James Cameron <span dir="ltr"><<a href="mailto:quozl@laptop.org">quozl@laptop.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im">On Mon, May 10, 2010 at 05:33:07PM +0100, Tiago Marques wrote:<br>
> On Mon, May 10, 2010 at 7:37 AM, James Cameron <<a href="mailto:quozl@laptop.org">quozl@laptop.org</a>> wrote:<br>
>     On Sat, May 08, 2010 at 05:24:00PM +0000, Tiago Marques wrote:<br>
>     > I was just looking into this and the issue with SD cards' random write<br>
>     > performance intrigued me in this particular case.   Isn't recording<br>
>     > being performed sequentially, hence no lag problem?<br>
><br>
>     At the moment, assuming an application that opens a file, and writes to<br>
>     it at _any_ speed, occasionally the write will block for a huge amount<br>
</div>>     of time.  [...]<br>
<div class="im">><br>
>     Now this is surprising given that the I/O rate is trivial, and that<br>
>     there is ample memory for buffering the writes.<br>
><br>
> Indeed. But that's the price paid for non-cached 0.04KB/s random write<br>
> media.<br>
<br>
</div>I'm worried you might not have understood my point.  I don't believe it<br>
should have anything to do with the speed of the media.  In this first<br>
test, the rate of the application write is much lower than the random<br>
write speed of the media.<br>
<br>
It is as if the kernel is failing to buffer a write, instead blocking<br>
it for the duration of some media related event.  I think this is wrong.<br></blockquote><div><br></div><div>I did get wrong what you said. Well, then that does go in line with the problem of Firefox freezing around the same time regardless of using a very fast SSD like Intel's X25-M(what linus used) vs regular HDDs. Given the speed of random writes on the intel SSD, they should be much lower. Their fix was moving ext3 and ext4 to default to data=writeback, which seems to me that went around the problem by a different approach, without exactly solving it. Plus, data=writeback is not very safe.</div>

<div><br></div><div>You seem to be on to something with those VM tweaks in the more recent e-mails.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>
I won't consider different filesystems or I/O schedulers until I can see<br>
why the kernel fails to buffer a write.  Because if it is going to do<br>
this, then no matter what filesystem or scheduler is used, it will<br>
happen again.<br></blockquote><div><br></div><div>True.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Userspace should be permitted to continue execution.<br>
<div class="im"><br>
>     [root@xo-a7-2a-5a tmp]# echo 1 > /proc/sys/vm/drop_caches<br>
>     [root@xo-a7-2a-5a tmp]# echo 2 > /proc/sys/vm/drop_caches<br>
>     [root@xo-a7-2a-5a tmp]# echo 3 > /proc/sys/vm/drop_caches<br>
>     [root@xo-a7-2a-5a tmp]# free<br>
</div><div class="im">>     [root@xo-a7-2a-5a tmp]# time strace -o /tmp/k -e write -T dd if=/dev/zero of=/root/file bs=8192 count=32000<br>
</div><div class="im">>     [root@xo-a7-2a-5a tmp]# free<br>
</div><div class="im">>     [root@xo-a7-2a-5a tmp]# grep write k|cut -f2 -d'<'|cut -f1 -d'>'|sort -rn|more<br>
>     11.648413<br>
>     8.020875<br>
>     4.299857<br>
><br>
</div><div class="im">>     I've no explanation for this behaviour.<br>
><br>
> hmmm? But this is to the tmpfs???<br>
<br>
</div>Not so.  This is to SD card.  /root is on SD card.  Please reconsider<br>
your reply in that light.<br></blockquote><div><br></div><div>I tested your script and I'm having an order of magnitude lower on my desktop (0.04) for the maximum delay but it still varies a lot. I'll have to look into it in more depth and test it on the XO when I find the time.</div>

<div><br></div><div>Best regards,</div><div>Tiago</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<font color="#888888"><br>
--<br>
</font><div><div></div><div class="h5">James Cameron<br>
<a href="http://quozl.linux.org.au/" target="_blank">http://quozl.linux.org.au/</a><br>
</div></div></blockquote></div><br>