upowerd kills USB performance

Bug #1342341 reported by Ruslan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
upower (Ubuntu)
New
Undecided
Unassigned

Bug Description

After launching Kubuntu and logging in to KDE I mount a USB storage device to e.g. /mnt/tmp and try the following command:

dd if=/dev/zero of=/mnt/tmp/testfile bs=16M count=100

I don't wait until it finishes, because when I press Ctrl+C, it waits several more seconds and prints that it has copied only one record and the speed was from 200 kB/s to 1.8MB/s, which is nowhere near the speed the device can operate.

On the other hand, if I rename /usr/lib/upower/upowerd and restart, the same command finishes in under a minute and says the speed was >30MB/s for USB3 and ~30MB/s for USB2 devices/ports.

This hasn't happened on Kubuntu 12.04, but does happen on 14.04.
Running powertop at the "Tunables" tab doesn't show any difference, so it doesn't look related to autosuspend or similar things.
This also happens with Kubuntu 14.04 LiveCD, not only with the already installed system.

I've tested this with 3 different USB devices: Transcend JF780 16GB (in USB 3.0 and 2.0 ports), OCZ ATV 8GB (USB 2.0 device) and Seagate SRD00F2 2TB (in USB 3.0 and 2.0 ports) with identical results.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: upower 0.9.23-2ubuntu1
ProcVersionSignature: Ubuntu 3.13.0-30.55-generic 3.13.11.2
Uname: Linux 3.13.0-30-generic i686
ApportVersion: 2.14.1-0ubuntu3.2
Architecture: i386
CurrentDesktop: KDE
Date: Wed Jul 16 00:29:34 2014
InstallationDate: Installed on 2014-05-26 (50 days ago)
InstallationMedia: Kubuntu 14.04 LTS "Trusty Tahr" - Release i386 (20140416.1)
SourcePackage: upower
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Ruslan (b7-10110111) wrote :
Revision history for this message
Ruslan (b7-10110111) wrote :

This appears to be because upowerd calls `pm-powersave false`, which in turn activates /usr/lib/pm-utils/power.d/laptop-mode, which writes 10 and 5 to /proc/sys/vm/dirty_ratio and /proc/sys/vm/dirty_background_ratio, respectively, replacing default 20 and 10.
Commenting this line in laptop-mode file works around this bug.

Now I'm not sure whether this bug is a kernel bug or a pm-utils one. It seems definitely not a upower bug.

BTW, this bug doesn't appear on another machine I tested it on, with GA-I915G-MF motherboard, while it appears on the problematic motherboard MSI B85-G41 PC Mate.

Revision history for this message
Ruslan (b7-10110111) wrote :

Also, writing back the default values to the /proc/sys/vm/... files doesn't fix the problem — so far only reboot with avoiding writing bad values helped.

Revision history for this message
Ruslan (b7-10110111) wrote :

In fact, it seems enough to write any value, even default+1, i.e. 21 to /proc/sys/vm/dirty_ratio to trigger the bug.

Revision history for this message
Ruslan (b7-10110111) wrote :

It appears to be the kernel bug. Sort of. I've bisected the kernel to commit ab8fabd46f811d5153d8a0cd2fac9a0d41fb593d. There's a discussion of this problem in this thread:
https://groups.google.com/forum/#!topic/linux.kernel/Jc69VRli3k0

This seems basically WONTFIX from linux side. But a workarounds are:

1. "vm.highmem_is_dirtyable=1" sysctl option — although this makes the performance not as high as it was in 3.2.x kernels, it at least allows one to use the disk subsystem
2. "mem=15G" kernel parameter limits the amount of usable memory, preventing the problems discussed in the thread I linked above
3. Use 64 bit kernel. This seems to be not a trivial thing to do with Ubuntu, but I may be wrong. But this is proposed as _the solution_.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.