aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-cache-policy-smq.c
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2015-06-17 11:43:38 -0400
committerMike Snitzer <snitzer@redhat.com>2015-06-17 12:40:38 -0400
commitbccab6a01afc26f53d91762d78153513cad10b29 (patch)
treea93caf5032b84668099e2ab35b7593cada04113c /drivers/md/dm-cache-policy-smq.c
parent6096d91af0b65a3967139b32d5adbb3647858a26 (diff)
dm cache: switch the "default" cache replacement policy from mq to smq
The Stochastic multiqueue (SMQ) policy (vs MQ) offers the promise of less memory utilization, improved performance and increased adaptability in the face of changing workloads. SMQ also does not have any cumbersome tuning knobs. Users may switch from "mq" to "smq" simply by appropriately reloading a DM table that is using the cache target. Doing so will cause all of the mq policy's hints to be dropped. Also, performance of the cache may degrade slightly until smq recalculates the origin device's hotspots that should be cached. In the future the "mq" policy will just silently make use of "smq" and the mq code will be removed. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Acked-by: Joe Thornber <ejt@redhat.com>
Diffstat (limited to 'drivers/md/dm-cache-policy-smq.c')
-rw-r--r--drivers/md/dm-cache-policy-smq.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/md/dm-cache-policy-smq.c b/drivers/md/dm-cache-policy-smq.c
index 66feb307e697..80f02d3330e2 100644
--- a/drivers/md/dm-cache-policy-smq.c
+++ b/drivers/md/dm-cache-policy-smq.c
@@ -1748,6 +1748,15 @@ static struct dm_cache_policy_type smq_policy_type = {
1748 .create = smq_create 1748 .create = smq_create
1749}; 1749};
1750 1750
1751static struct dm_cache_policy_type default_policy_type = {
1752 .name = "default",
1753 .version = {1, 0, 0},
1754 .hint_size = 4,
1755 .owner = THIS_MODULE,
1756 .create = smq_create,
1757 .real = &smq_policy_type
1758};
1759
1751static int __init smq_init(void) 1760static int __init smq_init(void)
1752{ 1761{
1753 int r; 1762 int r;
@@ -1758,12 +1767,20 @@ static int __init smq_init(void)
1758 return -ENOMEM; 1767 return -ENOMEM;
1759 } 1768 }
1760 1769
1770 r = dm_cache_policy_register(&default_policy_type);
1771 if (r) {
1772 DMERR("register failed (as default) %d", r);
1773 dm_cache_policy_unregister(&smq_policy_type);
1774 return -ENOMEM;
1775 }
1776
1761 return 0; 1777 return 0;
1762} 1778}
1763 1779
1764static void __exit smq_exit(void) 1780static void __exit smq_exit(void)
1765{ 1781{
1766 dm_cache_policy_unregister(&smq_policy_type); 1782 dm_cache_policy_unregister(&smq_policy_type);
1783 dm_cache_policy_unregister(&default_policy_type);
1767} 1784}
1768 1785
1769module_init(smq_init); 1786module_init(smq_init);