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>
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."),
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;