You are not logged in.

#1 2011-12-10 12:34:45

halfgaar
Member
Registered: 2010-05-22
Posts: 50

Computer unresponsive with disk activity, even when disk is USB

Hi,

I've always had issues with responsiveness with Linux when there is disk activity (several distro's, same hardware), whereas a Windows XP installation reacts very snappily. When I have a torrent client open, Mplayer keeps hanging a few times a minute (even more often when the download is going fast (2 MB/s)).

Recently I migrated to ext4 in the hopes that would fix it, but it didn't. It's also not something as simple as a DMA issue (because it's SATA). Disk throughput is about 80 MB/s, which is OK.

Anyway, currently, I'm performing this on a USB disk:

dd if=/dev/zero of=/dev/sdc1 bs=10M

And even then the computer is almost unusable, which it shouldn't be, because the internal disks are not used for this. And some time back when I was copying an AVI to a USB stick, it was utterly unusable.

Maybe it's a driver issue, because I can't imagine the normal schedulers being so horrible, but I can't say.

My disk controller can't be accessed with AHCI (there is no 'native' option in the BIOS), yet NCQ is enabled:

# dmesg|grep -i ncq
[    1.313605] ata3.00: 2930275055 sectors, multi 16: LBA48 NCQ (depth 0/32)
[    1.800338] ata4.00: 2930277168 sectors, multi 16: LBA48 NCQ (depth 0/32)
[    2.324738] ata6.00: 488395055 sectors, multi 16: LBA48 NCQ (depth 0/32)

I have kernel 3.1.1-1-ARCH, so I should have the 'wonder patch'.

Hardware:

CPU: Athlon X2 3800+ (2GHz dual core).
RAM: 2 GB DDR400 RAM.
Chipset: Nvidia nForce 4 ultra.
Disks (in MD RAID1): 2 WDC WD15EARS-00Z5B1 (disks have changed over the years) and 1 Seagate disk (which contains windows and is spun down in Linux, to prevent noise).

I disabled the (self-destructing) head parking feature of the caviar green disks with WDidle by setting the timeout to max (disabling the head parking with WDidle actually lets it trigger constantly, that's why I chose this way).

Lspci:

00:00.0 Memory controller: nVidia Corporation CK804 Memory Controller (rev a3)
00:01.0 ISA bridge: nVidia Corporation CK804 ISA Bridge (rev a3)
00:01.1 SMBus: nVidia Corporation CK804 SMBus (rev a2)
00:02.0 USB controller: nVidia Corporation CK804 USB Controller (rev a2)
00:02.1 USB controller: nVidia Corporation CK804 USB Controller (rev a3)
00:06.0 IDE interface: nVidia Corporation CK804 IDE (rev f2)
00:07.0 IDE interface: nVidia Corporation CK804 Serial ATA Controller (rev f3)
00:08.0 IDE interface: nVidia Corporation CK804 Serial ATA Controller (rev f3)
00:09.0 PCI bridge: nVidia Corporation CK804 PCI Bridge (rev a2)
00:0a.0 Bridge: nVidia Corporation CK804 Ethernet Controller (rev a3)
00:0b.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)
00:0c.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)
00:0d.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)
00:0e.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)
00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration
00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map
00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller
00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control
01:07.0 Multimedia audio controller: Creative Labs SB Audigy (rev 04)
01:07.1 Input device controller: Creative Labs SB Audigy Game Port (rev 04)
01:07.2 FireWire (IEEE 1394): Creative Labs SB Audigy FireWire Port (rev 04)
01:08.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
01:08.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
05:00.0 VGA compatible controller: nVidia Corporation G96 [GeForce 9500 GT] (rev a1)
# cat /proc/mdstat ( which shows no write intent bitmap to slow it down):

Personalities : [raid1] 
md1 : active raid1 sda2[0] sdb2[1]
      1464969720 blocks super 1.0 [2/2] [UU]
      
md0 : active raid1 sda1[0] sdb1[1]
      156788 blocks super 1.0 [2/2] [UU]
      
unused devices: <none>

Anybody know what might be causing this?

Offline

#2 2011-12-10 12:37:24

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

Re: Computer unresponsive with disk activity, even when disk is USB

You can try using different schedulers etc. (see the linked threads for various suggestions).
You're not the only one suffering from this issue: https://bbs.archlinux.org/viewtopic.php … 2#p1025622

Offline

#3 2011-12-10 12:45:02

halfgaar
Member
Registered: 2010-05-22
Posts: 50

Re: Computer unresponsive with disk activity, even when disk is USB

I was under the impression that CFQ was the best for interactivity, but I'm trying deadline now. Let's see how this works.

I also need to find out how to set the default, for newly plugged SD drives.

Offline

#4 2011-12-10 13:05:25

halfgaar
Member
Registered: 2010-05-22
Posts: 50

Re: Computer unresponsive with disk activity, even when disk is USB

It doesn't seem to help, BTW...

Offline

#5 2011-12-10 16:13:06

cybertorture
Member
Registered: 2010-05-05
Posts: 339

Re: Computer unresponsive with disk activity, even when disk is USB

If your sata controller support AHCI best scheduler is noop, cqf is nice also but you will have to use ionice with every extensive operation also for some daemons like torrents etc ...
You can set it as default with elevator=noop or deadline as boot option.

Last edited by cybertorture (2011-12-10 16:14:56)


O' rly ? Ya rly Oo

Offline

#6 2011-12-11 11:56:21

Pajaro
Member
Registered: 2004-04-21
Posts: 884

Re: Computer unresponsive with disk activity, even when disk is USB

this is the configuration I use to keep my system responsive:
- kernel-ck-* with elevator=bfq in grub
- verynice-fork
- noatime for local disks in fstab
- irqbalancing

And I use these to make it load faster:
- prelink
- e4rat

Also, removing 2 years of firefox history, which sucks, turned my constantly freezing firefox into a fast responsive browser.

Offline

#7 2011-12-11 20:59:06

MadCat_X
Member
Registered: 2009-10-08
Posts: 189

Re: Computer unresponsive with disk activity, even when disk is USB

I recently tried to play around with the schedulers and I found out that using "deadline" for my internal drives, "cfq"  for my optical drive and "noop" for everything else. I tried copying a load of small files on my USB flashdrive while playing a movie from the optical drive and the system felt very responsive. I run a 3.2-rc5 kernel which seems to help considerably though.
BTW, I noticed that the NCQ queue on your drives is of 0 length, try setting it o 31 like this (as root).

echo 31 > /sys/block/sdX/device/queue_depth

I use a customized rc.local script to set the schedulers up upon boot and elevator=noop to force noop for all other devices. You might want to use udev rules to use noop only for flash drives and default to CFQ for everything else.

Offline

#8 2011-12-11 21:37:13

halfgaar
Member
Registered: 2010-05-22
Posts: 50

Re: Computer unresponsive with disk activity, even when disk is USB

I recently tried to play around with the schedulers and I found out that using "deadline" for my internal drives, "cfq"  for my optical drive and "noop" for everything else. I tried copying a load of small files on my USB flashdrive while playing a movie from the optical drive and the system felt very responsive.

I've been playing some more, and you're right in that it seems that with the internal disks at deadline, the system is a lot more responsive. Previously, I put the external disk I was zeroing at deadline too, but that (I know now) made it worse again.

I run a 3.2-rc5 kernel which seems to help considerably though.

Has there been any specific change in that kernel to cause that?

BTW, I noticed that the NCQ queue on your drives is of 0 length, try setting it o 31 like this (as root).

I always wondered about the NCQ queue. In pages about NCQ that I found, the dmesg also reported a queue of 0. I just always figured it meant how many commands it currently had, being zero at boot time.

When I do "cat /sys/block/sda/device/queue_depth" it always says one, regardless of disk activity.

Offline

#9 2011-12-11 22:08:01

MadCat_X
Member
Registered: 2009-10-08
Posts: 189

Re: Computer unresponsive with disk activity, even when disk is USB

It's worth noting that "deadline" is reported to perform significantly worse if there's a lot of concurrent read and write operations, CFQ seems to handle this better.

There's been this patch which - if I understand it correctly - trades waiting for available hugepage for fast memory allocation. I noticed the system becoming snappier just by updating to 3.2-rc5.

Are you sure the BIOS is configured correctly, is there an update available? Don't take this for granted but I always thought that the NCQ queue depth is the max number of concurrent commands, if it's zero, NCQ can't be working. Also, a commentary under certain article says

If the device supports NCQ but the host doesn’t, you’ll get

ata8.00: ATA-7, max UDMA7, 312581808 sectors: LBA48 NCQ (depth 0/32)

Offline

#10 2011-12-12 20:24:41

halfgaar
Member
Registered: 2010-05-22
Posts: 50

Re: Computer unresponsive with disk activity, even when disk is USB

Thus far, my experience is the other way around. THe main problem has always been that when there is a lot of disk activity, it can take up to one minute before my KDE application menu pops up after clicking it.

I've been researching NCQ and it seems that my chipset doesn't doesn't do so (source: launchpad bug report). At least, there are no proper drivers:

NVIDIA
Driver name: sata_nv

Summary: No TCQ/NCQ in early chipsets. NCQ support added in later chipsets. Looks like a PATA controller, but with full SATA control including hotplug and PM.

Update: NVIDIA has provided information (under NDA) that permits implementation of NCQ support, and a sample Linux implementation (patch) as well. Unfortunately, the patch needs debugging, and no one seems to have the time or motivation.

NOTE: Newer NVIDIA chipsets are AHCI, and use the ahci driver rather than the sata_nv driver.

There are kernel options, but that link speaks of data corruption, so I guess I won't try...

Offline

#11 2011-12-13 10:53:02

Pawlerson
Member
Registered: 2010-09-01
Posts: 44

Re: Computer unresponsive with disk activity, even when disk is USB

halfgaar wrote:

Anybody know what might be causing this?

Do you use 32 or 64bit system? It is a known problem on 64bit systems, but some people say the same happens on 64bit windowses. smile Afaik there are some patches in kernel 3.2 that should help with your problem, but the kernel isn't stable yet, so check it if you want, but on your own risk. wink

PS. There's also a chance properly set cgroups will help.

Last edited by Pawlerson (2011-12-13 10:55:09)

Offline

#12 2011-12-13 20:16:46

halfgaar
Member
Registered: 2010-05-22
Posts: 50

Re: Computer unresponsive with disk activity, even when disk is USB

I have a 64 bit system. I can't really compare with when I used Gentoo 32 bit, but I do know that too behaved too unresponsively.

Offline

#13 2011-12-14 06:21:48

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Computer unresponsive with disk activity, even when disk is USB

halfgaar wrote:

when there is a lot of disk activity, it can take up to one minute before my KDE application menu pops up after clicking it.

Use commit option - I had same problem with Gnome years ago (but only for a few seconds, not a whole minute).

Use ionice to prioritize the disk activity.

Showing the application menu, first requires that all the small icon files for the apps in the menu be read from disk.

Offline

#14 2011-12-14 20:07:15

halfgaar
Member
Registered: 2010-05-22
Posts: 50

Re: Computer unresponsive with disk activity, even when disk is USB

Isn't commit=60 only useful for ext3? I thought ext4 already had a much longer commit interval.

Offline

#15 2011-12-14 22:00:14

paziul
Member
From: N.C.
Registered: 2011-11-23
Posts: 27

Re: Computer unresponsive with disk activity, even when disk is USB

I got these 'tweaks' active to increase transfer rates on SATA drives in non RAID setups and this also lowered down the "un-responsiveness" on systems with cfq and bfq io scheduler ( on large file access / operations such as copy / decompress etc... ) - the result also varies using different process schedulers - cfs and bfs... I am not 100% satisfied with bfs but I think it runs best in my case.

do a test with and without these settings and compare results....

# request queues
echo 4096 > /sys/block/sda/queue/nr_requests
echo 4096 > /sys/block/sdb/queue/nr_requests

# readahead 
blockdev --setra 16384 /dev/sda   
blockdev --setra 16384 /dev/sdb

"...and it probably never will support anything other than AT-harddisks..."

Offline

#16 2011-12-15 00:55:51

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Computer unresponsive with disk activity, even when disk is USB

halfgaar wrote:

I thought ext4 already had a much longer commit interval.

Taking a quick look at the kernel sources:

include/linux/jbd2.h:#define JBD2_DEFAULT_MAX_COMMIT_AGE 5

And that constant is used a lot in fs/ext4/

Offline

#17 2011-12-15 04:17:15

slytux
Member
From: New York
Registered: 2010-09-25
Posts: 129

Re: Computer unresponsive with disk activity, even when disk is USB

Huge pages, slow drives, and long delays
http://lwn.net/Articles/467328/

Offline

#18 2011-12-16 04:08:23

Thorsten Reinbold
Member
From: Germany
Registered: 2011-12-06
Posts: 353

Re: Computer unresponsive with disk activity, even when disk is USB

paziul wrote:

I got these 'tweaks' active to increase transfer rates on SATA drives in non RAID setups and this also lowered down the "un-responsiveness" on systems with cfq and bfq io scheduler ( on large file access / operations such as copy / decompress etc... ) - the result also varies using different process schedulers - cfs and bfs... I am not 100% satisfied with bfs but I think it runs best in my case.

do a test with and without these settings and compare results....

# request queues
echo 4096 > /sys/block/sda/queue/nr_requests
echo 4096 > /sys/block/sdb/queue/nr_requests

# readahead 
blockdev --setra 16384 /dev/sda   
blockdev --setra 16384 /dev/sdb

How to make those settings permanent? Helped a lot on my system.

Offline

#19 2011-12-16 14:54:48

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

Re: Computer unresponsive with disk activity, even when disk is USB

Have you tried putting them in rc.local?

Last edited by karol (2011-12-16 14:54:58)

Offline

#20 2011-12-18 12:17:52

FiX
Member
Registered: 2011-12-17
Posts: 8

Re: Computer unresponsive with disk activity, even when disk is USB

Seens like 3.2 kernel fixed this issue. Now testing it on my laptop.

More info about: http://www.h-online.com/open/features/K … 95236.html
(Memory management section)

Offline

#21 2011-12-19 21:33:55

ShwangShwing
Member
Registered: 2011-04-20
Posts: 17

Re: Computer unresponsive with disk activity, even when disk is USB

@FiX tell if it makes difference. I'll probably try 3.2 this weekend if I have enough time.

Offline

#22 2011-12-21 10:58:15

FiX
Member
Registered: 2011-12-17
Posts: 8

Re: Computer unresponsive with disk activity, even when disk is USB

@ShwangShwing, after upgrade I cannot reproduce this bug anymore.

Last edited by FiX (2011-12-21 10:58:27)

Offline

Board footer

Powered by FluxBB