]> granicus.if.org Git - zfs/commitdiff
Fix zfs_dirty_data_max overflow on 32-bit
authortuxoko <tuxoko@gmail.com>
Fri, 30 Oct 2015 23:10:01 +0000 (16:10 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 20 Nov 2015 00:02:47 +0000 (16:02 -0800)
On 32 bit, the calculation of zfs_dirty_data_max from phymem will overflow,
causing it to be smaller than zfs_dirty_data_sync, and will cause txg being
delayed while no one write to disk. The end result is horrendous write speed.

On 4G ram 32-bit VM, before this patch, simple dd results in ~7MB/s. Now it
can reach speed on par with 64-bit VM.

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3973

module/zfs/arc.c

index c1e0bfbbaf14a74e42940117b6d8ff190ccd9910..4e7e059248776b4eb3b0b7a76bc5d2708de3f97e 100644 (file)
@@ -5479,11 +5479,11 @@ arc_init(void)
         * zfs_dirty_data_max_max (default 25% of physical memory).
         */
        if (zfs_dirty_data_max_max == 0)
-               zfs_dirty_data_max_max = physmem * PAGESIZE *
+               zfs_dirty_data_max_max = (uint64_t)physmem * PAGESIZE *
                    zfs_dirty_data_max_max_percent / 100;
 
        if (zfs_dirty_data_max == 0) {
-               zfs_dirty_data_max = physmem * PAGESIZE *
+               zfs_dirty_data_max = (uint64_t)physmem * PAGESIZE *
                    zfs_dirty_data_max_percent / 100;
                zfs_dirty_data_max = MIN(zfs_dirty_data_max,
                    zfs_dirty_data_max_max);