You are not logged in.

#1 2011-11-28 13:04:18

KubAT
Member
From: Poland
Registered: 2011-07-27
Posts: 9
Website

Copy data to USB stick - System Lag

Hi, since I can remember I have a problem with copy date to USB Stick.

When the file is big, after copying the 400-600 MB system start lagging and speed is rly slow.
System Freeze (I can move the mouse but for eg. Browser not responde)  for a 5-10 sec, then copy 200-300Mb and again freeze .

Checked on different sticks and different file system (NTFS, FAT32)
Arch x64

Sorry for my bad english.

Offline

#2 2011-11-28 13:28:25

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Copy data to USB stick - System Lag

There are many threads about terrible slowdowns when copying to a usb pendrive or even to another partition.
https://bbs.archlinux.org/viewtopic.php?id=127051

Offline

#3 2011-11-30 06:28:36

pigiron
Member
From: USA
Registered: 2009-07-14
Posts: 150

Re: Copy data to USB stick - System Lag

I've had this happen also...and I just ran across this article in LWN:

http://lwn.net/Articles/467328/#Comments

Since you're posting in "Newbie Corner", you might not totally understand the details, but the problem may possibly be in the Linux kernel Memory Manager (MM) if the kernel was configured with CONFIG_TRANSPARENT_HUGEPAGE=y... like the Arch kernel is.

Since Linux runs on such a large variety of hardware, this appears to be one of those issues that the kernel developers will fight about for some time on the best way to handle it... and then finally drop a change. Well... I should say that I've seen similar problems handled that way in the past.

So either have patience, or if you're very ambitious, you might try to compile your own kernel with the patch from that web link and see if it makes the problem any better.

Oh... your English is much better than my Polish.

Offline

#4 2011-12-26 16:40:54

stqn
Member
Registered: 2010-03-19
Posts: 1,191
Website

Re: Copy data to USB stick - System Lag

The other day copying a 3.7 GB file to my USB stick took about 45 min : 1.4 MB/s. (I wasn't using the computer at the same time so didn't notice any freeze or lag.)

Today after reading about the huge pages thing, I tried again, with and without transparent huge pages enabled.

Enabled: firefox and another application froze frequently (firefox for several minutes at a time), copy completed in 43 min but only after I disabled huge pages because my computer was really unusable.

Disabled: no freeze or lag, copy completed in 30 min (2.1 MB/s).

So for me disabling THP helps a lot, but write speed is still slow (from what I read my Kingston Datatraveler G3 should be able to write big files at 7+ MB/s).

Disabling THP is easy, no need to rebuild the kernel. Just type:

sudo bash -c 'echo "never" > /sys/kernel/mm/transparent_hugepage/enabled'

Edit: removed the sysctl.conf modification since it doesn't work. Apparently only settings from /proc/sys can be set in /etc/sysctl.conf...

For completeness here's my setup:
Linux kernel 3.1.5-1, x86_64, 4 GB RAM, no swap, Gigabyte H55N-USB3 motherboard, Kingston Datatraveler G3 8GB (plugged into a USB2 port, with its original FAT32 partition, and mounted by Thunar with the "flush" option).

Edit: another possibility seems to be to disable defragmentation of huge pages.

Last edited by stqn (2011-12-29 19:30:54)

Offline

#5 2012-01-08 12:23:29

flatwhatson
Member
Registered: 2008-01-09
Posts: 3

Re: Copy data to USB stick - System Lag

Wow, I have been suffering this problem for a long time, but disabling transparent hugepage as in stqn's post has completely solved it for me!

18 MB/s with zero lag to my 32G Patriot Xporter XT.

Horay!

Offline

#6 2012-01-08 13:59:39

sxe
Member
Registered: 2009-06-04
Posts: 103

Re: Copy data to USB stick - System Lag

flatwhatson wrote:

Wow, I have been suffering this problem for a long time, but disabling transparent hugepage as in stqn's post has completely solved it for me!
Horay!

Same here. I had this problem several years.
Disabling usb legacy support in the bios helped a lot but disabling hugepages defragmentation ficed it completely for me. No more lag since then.

Here is how it works:
https://bbs.archlinux.org/viewtopic.php … 5#p1033575

You don't have to disable hugepages at all, only disable defragmentation.

Offline

#7 2012-01-24 19:06:10

KubAT
Member
From: Poland
Registered: 2011-07-27
Posts: 9
Website

Re: Copy data to USB stick - System Lag

Thanks, I Disable usb legacy support and disable hugepages defragmentation
and now is much better.

Offline

#8 2012-01-31 00:14:13

ilkyest
Member
From: Brazil
Registered: 2010-02-13
Posts: 269

Re: Copy data to USB stick - System Lag

Yeah..... finally. thanks so much guys.....

about 11,2mb/s with 52mb/s peak.... copying two 1,2Gb wave file

Offline

Board footer

Powered by FluxBB