]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: add boundary for cache-autotune related settings 25605/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Thu, 6 Dec 2018 10:15:55 +0000 (18:15 +0800)
committerNathan Cutler <ncutler@suse.com>
Tue, 18 Dec 2018 11:26:42 +0000 (12:26 +0100)
E.g., because user configures something wrong or we don't expected.

Fixes: http://tracker.ceph.com/issues/37507
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
(cherry picked from commit c2c9245ee63cb135020061d90822745d91bb962d)

src/common/options.cc
src/os/bluestore/BlueStore.cc

index b2246579eb8c649b0d0314814d90c4241932218e..652371267446360dc30ae04c7b5c5a96cef25e61 100644 (file)
@@ -3648,6 +3648,7 @@ std::vector<Option> get_global_options() {
 
     Option("osd_memory_expected_fragmentation", Option::TYPE_FLOAT, Option::LEVEL_DEV)
     .set_default(0.15)
+    .set_min_max(0.0, 1.0)
     .add_see_also("bluestore_cache_autotune")
     .set_description("When tcmalloc and cache autotuning is enabled, estimate the percent of memory fragmentation."),
 
index b833c00cc872ffa1ceec0245d5d83f625d04bc4b..00defcd27dade007cb637c3ce3f9a8cd47603b52 100644 (file)
@@ -3568,8 +3568,12 @@ void BlueStore::MempoolThread::_tune_cache_size(bool interval_stats)
   uint64_t target = store->osd_memory_target;
   uint64_t base = store->osd_memory_base;
   double fragmentation = store->osd_memory_expected_fragmentation;
-  uint64_t cache_max = ((1.0 - fragmentation) * target) - base;
   uint64_t cache_min = store->osd_memory_cache_min;
+  uint64_t cache_max = cache_min;
+  uint64_t limited_target = (1.0 - fragmentation) * target;
+  if (limited_target > base + cache_min) {
+    cache_max = limited_target - base;
+  }
 
   size_t heap_size = 0;
   size_t unmapped = 0;