]> git.proxmox.com Git - zfsonlinux.git/blame - zfs-patches/0054-Fix-MMP-write-frequency-for-large-pools.patch
bump version to 0.7.7-pve1~bpo9
[zfsonlinux.git] / zfs-patches / 0054-Fix-MMP-write-frequency-for-large-pools.patch
CommitLineData
75b07eca
FG
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Brian Behlendorf <behlendorf1@llnl.gov>
3Date: Mon, 12 Mar 2018 11:26:05 -0700
4Subject: [PATCH] Fix MMP write frequency for large pools
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9When a single pool contains more vdevs than the CONFIG_HZ for
10for the kernel the mmp thread will not delay properly. Switch
11to using cv_timedwait_sig_hires() to handle higher resolution
12delays.
13
14This issue was reported on Arch Linux where HZ defaults to only
15100 and this could be fairly easily reproduced with a reasonably
16large pool. Most distribution kernels set CONFIG_HZ=250 or
17CONFIG_HZ=1000 and thus are unlikely to be impacted.
18
19Reviewed-by: George Melikov <mail@gmelikov.ru>
20Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
21Reviewed-by: Olaf Faaland <faaland1@llnl.gov>
22Reviewed-by: Tony Hutter <hutter2@llnl.gov>
23Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
24Closes #7205
25Closes #7289
26(cherry picked from commit c30e716c8149b7df7cf968373c22aa00b48d17b8)
27Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
28---
29 lib/libspl/include/sys/time.h | 6 +++++-
30 module/zfs/mmp.c | 6 +++---
31 2 files changed, 8 insertions(+), 4 deletions(-)
32
33diff --git a/lib/libspl/include/sys/time.h b/lib/libspl/include/sys/time.h
34index f05fcaa1c..dc645fa5c 100644
35--- a/lib/libspl/include/sys/time.h
36+++ b/lib/libspl/include/sys/time.h
37@@ -54,10 +54,14 @@
38 #define MSEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MILLISEC))
39 #endif
40
41-#ifndef NSEC2MSEC
42+#ifndef NSEC2MSEC
43 #define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC))
44 #endif
45
46+#ifndef USEC2NSEC
47+#define USEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MICROSEC))
48+#endif
49+
50 #ifndef NSEC2SEC
51 #define NSEC2SEC(n) ((n) / (NANOSEC / SEC))
52 #endif
53diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c
54index 15eea41ab..dc5c6a74f 100644
55--- a/module/zfs/mmp.c
56+++ b/module/zfs/mmp.c
57@@ -462,9 +462,9 @@ mmp_thread(spa_t *spa)
58 mmp_write_uberblock(spa);
59
60 CALLB_CPR_SAFE_BEGIN(&cpr);
61- (void) cv_timedwait_sig(&mmp->mmp_thread_cv,
62- &mmp->mmp_thread_lock, ddi_get_lbolt() +
63- ((next_time - gethrtime()) / (NANOSEC / hz)));
64+ (void) cv_timedwait_sig_hires(&mmp->mmp_thread_cv,
65+ &mmp->mmp_thread_lock, next_time, USEC2NSEC(1),
66+ CALLOUT_FLAG_ABSOLUTE);
67 CALLB_CPR_SAFE_END(&cpr, &mmp->mmp_thread_lock);
68 }
69
70--
712.14.2
72