]> git.proxmox.com Git - zfsonlinux.git/blob - zfs/debian/patches/0004-increase-default-zcmd-allocation-to-256K.patch
add 3 patches for lintian errors
[zfsonlinux.git] / zfs / debian / patches / 0004-increase-default-zcmd-allocation-to-256K.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Colin Ian King <colin.king@canonical.com>
3 Date: Tue, 31 Oct 2017 19:12:42 +0800
4 Subject: [PATCH] increase-default-zcmd-allocation-to-256K
5
6 Increase default zcmd allocation to 256K (LP: #567557)
7
8 When creating hundreds of clones (for example using containers with
9 LXD) cloning slows down as the number of clones increases over time.
10 The reason for this is that the fetching of the clone information
11 using a small zcmd buffer requires two ioctl calls, one to determine
12 the size and a second to return the data. However, this requires
13 gathering the data twice, once to determine the size and again to
14 populate the zcmd buffer to return it to userspace.
15
16 These are expensive ioctl() calls, so instead, make the default buffer
17 size much larger: 256K. This may sound large, but on 64 bit systems
18 running ZFS this is not a huge chunk of memory for the speed
19 improvement we gains for large sets of clones:
20
21 16K zcmd 256K zcmd
22 Clones Time Clones Time Clone % improvement
23 (secs) per sec (secs) per sec
24 100 7 14.29 5 20.00 28.57
25 200 10 20.00 9 22.22 10.00
26 300 19 15.79 18 16.67 5.26
27 400 22 18.18 22 18.18 0.00
28 500 29 17.24 29 17.24 0.00
29 600 39 15.38 39 15.38 0.00
30 700 46 15.22 45 15.56 2.17
31 800 58 13.79 51 15.69 12.07
32 900 74 12.16 61 14.75 17.57
33 1000 90 11.11 74 13.51 17.78
34 1100 98 11.22 87 12.64 11.22
35 1200 102 11.76 95 12.63 6.86
36 1300 113 11.50 104 12.50 7.96
37 1400 143 9.79 109 12.84 23.78
38 1500 145 10.34 132 11.36 8.97
39 1600 165 9.70 145 11.03 12.12
40 1700 187 9.09 156 10.90 16.58
41 1800 210 8.57 166 10.84 20.95
42 1900 226 8.41 183 10.38 19.03
43 2000 256 7.81 198 10.10 22.66
44 2200 311 7.07 238 9.24 23.47
45 2400 373 6.43 271 8.86 27.35
46 2600 487 5.34 316 8.23 35.11
47 3000 619 4.85 426 7.04 31.18
48 3400 915 3.72 549 6.19 40.00
49 4000 1332 3.00 923 4.33 30.71
50
51 As one can see, with > 2000 clones we get 25-40% speed
52 improvement.
53
54 This patch was originally suggested by Brian Behlendorf
55 (see https://github.com/zfsonlinux/zfs/issues/6372), however
56 this fix is a more generic fix to cover all zcmd cases.
57
58 Signed-off-by: Colin Ian King <colin.king@canonical.com>
59 ---
60 lib/libzfs/libzfs_util.c | 2 +-
61 1 file changed, 1 insertion(+), 1 deletion(-)
62
63 diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c
64 index 19bb57ad4..2a069ffe6 100644
65 --- a/lib/libzfs/libzfs_util.c
66 +++ b/lib/libzfs/libzfs_util.c
67 @@ -1134,7 +1134,7 @@ int
68 zcmd_alloc_dst_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc, size_t len)
69 {
70 if (len == 0)
71 - len = 16 * 1024;
72 + len = 256 * 1024;
73 zc->zc_nvlist_dst_size = len;
74 zc->zc_nvlist_dst =
75 (uint64_t)(uintptr_t)zfs_alloc(hdl, zc->zc_nvlist_dst_size);