Снял двухмегабайтовые ограничения на буфер записи:
[root ~]# echo 50 > /proc/sys/vm/dirty_background_ratio
[root ~]# echo 50 > /proc/sys/vm/dirty_ratio
Запустил dd. Типичные размеры буферов во время копирования:
$ egrep 'Dirty|Writeback:' /proc/meminfo
Dirty: 333220 kB
Writeback: 24764 kB
Скорость:
$ dd if=/dev/zero bs=1M > ~/tmp/blob
dd: запись «стандартный вывод»: На устройстве кончилось место
4511+0 записей считано
4510+0 записей написано
скопировано 4729249792 байта (4,7 GB), 108,881 c, 43,4 MB/c
Тормозов нет. Вообще нет. Это успех, господа.
P.S. Для тех, кому 3.2 не помог, обещают ништяки в 3.3:
Fixes for those went into 3.3-rc1. Quoting from this weeks LWN.net kernel page
(I'm quite sure Jonathan won't mind):
"""
There have been some significant changes made to the memory compaction code to
avoid the lengthy stalls experienced by some users when writing data to slow
devices (USB keys, for example). This problem was described in this article
(http://lwn.net/Articles/467328/), but the solution has evolved considerably.
By making a number of changes to how compaction works, the memory management
hackers (and Mel Gorman in particular) were able to avoid disabling synchronous
compaction, which had the unfortunate effect of reducing huge page usage. See
this commit (
http://git.kernel.org/linus/a77ebd333cd810d7b680d544be88c875131c2bd3 ) for a
lot of information on how this problem was addressed.
"""