Bug 63531

Summary: Disabling in-memory write cache for x86-64
Product: Memory Management Reporter: Artem S. Tashkinov (aros)
Component: OtherAssignee: Andrew Morton (akpm)
Status: CLOSED INVALID    
Severity: normal CC: alan
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 3.11 Tree: Mainline
Regression: No
Attachments: 3.11 configuration

Description Artem S. Tashkinov 2013-10-23 06:02:50 UTC
Created attachment 112021 [details]
3.11 configuration

On my x86-64 PC (Intel Core i5 2500, 16GB RAM), I have the same 3.11 kernel
built for the i686 (with PAE) and x86-64 architectures. What's really troubling me is that the x86-64 kernel has the following problem:

When I copy large files to any storage device, be it my HDD with ext4 partitions
or flash drive with a FAT32 partition, the kernel first caches them in memory entirely then flushes them some time later (quite unpredictably though) or immediately upon running "sync".

How can I disable this in-memory cache altogether? When running the i686 kernel with the same configuration I don't observe this effect - files get written out almost immediately (for instance "sync" takes less than a second, whereas on x86-64 it can take a dozen of minutes depending on a file size and storage performance).

I'm _not_ talking about disabling write cache on my storage itself (hdparm -W 0 /dev/XXX)- firstly this command is detrimental to the performance of my PC, secondly, it won't help in this instance.

Swap is totally disabled, usually my memory is entirely free.

Please, advise.
Comment 1 Alan 2013-11-13 12:05:30 UTC
Not a support forum
Comment 2 Artem S. Tashkinov 2013-11-13 12:20:42 UTC
A bug which causes serious stalls can hardly be called an attempt at turning a bugzilla into a support forum, Alan. The way you close bug reports is often user hostile to put it humbly.

At least, you could give a link to a discussion which spans over 50 messages right now, and where Linus himself admits that the way dirty buffers are set up on x86-64 is not exactly the right way given today's RAM sizes.

If anyone ever stumbles upon this bug report, please, read this discussion:

http://linux-kernel.2935.n7.nabble.com/Disabling-in-memory-write-cache-for-x86-64-in-Linux-II-td742553.html

or here

http://comments.gmane.org/gmane.linux.kernel.mm/108708

A quick sane solution is to set sysctl variables this way:

vm.dirty_background_bytes=33554432
vm.dirty_bytes=134217728