1 ============================= 2 Guidance for writing policies 3 ============================= 4 5 Try to keep transactionality out of it. The c 6 avoid asking about anything that is migrating. 7 makes it easier to write the policies. 8 9 Mappings are loaded into the policy at constru 10 11 Every bio that is mapped by the target is refe 12 The policy can return a simple HIT or MISS or 13 14 Currently there's no way for the policy to iss 15 e.g. to start writing back dirty blocks that a 16 soon. 17 18 Because we map bios, rather than requests it's 19 to get fooled by many small bios. For this re 20 issues periodic ticks to the policy. It's sug 21 doesn't update states (eg, hit counts) for a b 22 for each tick. The core ticks by watching bio 23 trying to see when the io scheduler has let th 24 25 26 Overview of supplied cache replacement policie 27 ============================================== 28 29 multiqueue (mq) 30 --------------- 31 32 This policy is now an alias for smq (see below 33 34 The following tunables are accepted, but have 35 36 'sequential_threshold <#nr_sequential_ 37 'random_threshold <#nr_random_ios>' 38 'read_promote_adjustment <value>' 39 'write_promote_adjustment <value>' 40 'discard_promote_adjustment <value>' 41 42 Stochastic multiqueue (smq) 43 --------------------------- 44 45 This policy is the default. 46 47 The stochastic multi-queue (smq) policy addres 48 with the multiqueue (mq) policy. 49 50 The smq policy (vs mq) offers the promise of l 51 improved performance and increased adaptabilit 52 workloads. smq also does not have any cumbers 53 54 Users may switch from "mq" to "smq" simply by 55 DM table that is using the cache target. Doin 56 mq policy's hints to be dropped. Also, perfor 57 degrade slightly until smq recalculates the or 58 that should be cached. 59 60 Memory usage 61 ^^^^^^^^^^^^ 62 63 The mq policy used a lot of memory; 88 bytes p 64 bit machine. 65 66 smq uses 28bit indexes to implement its data s 67 pointers. It avoids storing an explicit hit c 68 has a 'hotspot' queue, rather than a pre-cache 69 the entries (each hotspot block covers a large 70 cache block). 71 72 All this means smq uses ~25bytes per cache blo 73 memory, but a substantial improvement nonethel 74 75 Level balancing 76 ^^^^^^^^^^^^^^^ 77 78 mq placed entries in different levels of the m 79 based on their hit count (~ln(hit count)). Th 80 levels generally had the most entries, and the 81 few. Having unbalanced levels like this reduc 82 multiqueue. 83 84 smq does not maintain a hit count, instead it 85 the least recently used entry from the level a 86 ordering being a side effect of this stochasti 87 scheme we can decide how many entries occupy e 88 resulting in better promotion/demotion decisio 89 90 Adaptability: 91 The mq policy maintained a hit count for each 92 different block to get promoted to the cache i 93 exceed the lowest currently in the cache. Thi 94 long time for the cache to adapt between varyi 95 96 smq doesn't maintain hit counts, so a lot of t 97 away. In addition it tracks performance of th 98 is used to decide which blocks to promote. If 99 performing badly then it starts moving entries 100 levels. This lets it adapt to new IO patterns 101 102 Performance 103 ^^^^^^^^^^^ 104 105 Testing smq shows substantially better perform 106 107 cleaner 108 ------- 109 110 The cleaner writes back all dirty blocks in a 111 112 Examples 113 ======== 114 115 The syntax for a table is:: 116 117 cache <metadata dev> <cache dev> <orig 118 <#feature_args> [<feature arg>]* 119 <policy> <#policy_args> [<policy arg>] 120 121 The syntax to send a message using the dmsetup 122 123 dmsetup message <mapped device> 0 sequ 124 dmsetup message <mapped device> 0 rand 125 126 Using dmsetup:: 127 128 dmsetup create blah --table "0 2684354 129 /dev/sdd 512 0 mq 4 sequential_thr 130 creates a 128GB large mapped device na 131 sequential threshold set to 1024 and t
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.