.add_see_also("bluestore_cache_autotune")
.set_description("When tcmalloc and cache autotuning is enabled, try to keep this many bytes mapped in memory."),
+ Option("osd_memory_target_cgroup_limit_ratio", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
+ .set_default(0.8)
+ .set_min_max(0.0, 1.0)
+ .add_see_also("osd_memory_target")
+ .set_description("Set the default value for osd_memory_target to the cgroup memory limit (if set) times this value")
+ .set_long_description("A value of 0 disables this feature."),
+
Option("osd_memory_base", Option::TYPE_SIZE, Option::LEVEL_DEV)
.set_default(768_M)
.add_see_also("bluestore_cache_autotune")
#include "include/intarith.h"
#include "include/stringify.h"
#include "include/str_map.h"
+#include "include/util.h"
#include "common/errno.h"
#include "common/safe_io.h"
#include "common/PriorityCache.h"
"bluestore_max_blob_size_ssd",
"bluestore_max_blob_size_hdd",
"osd_memory_target",
+ "osd_memory_target_cgroup_limit_ratio",
"osd_memory_base",
"osd_memory_cache_min",
"bluestore_cache_autotune",
int BlueStore::_set_cache_sizes()
{
+ // set osd_memory_target *default* based on cgroup limit?
+ // (do this before we fetch the osd_memory_target value!)
+ double cgroup_ratio = cct->_conf.get_val<double>(
+ "osd_memory_target_cgroup_limit_ratio");
+ if (cgroup_ratio > 0.0) {
+ uint64_t cgroup_limit = 0;
+ if (get_cgroup_memory_limit(&cgroup_limit) == 0 &&
+ cgroup_limit) {
+ uint64_t def = cgroup_limit * cgroup_ratio;
+ dout(10) << __func__ << " osd_memory_target_cgroup_limit_ratio "
+ << cgroup_ratio << ", cgroup_limit " << cgroup_limit
+ << ", defaulting osd_memory_target to " << def
+ << dendl;
+ cct->_conf.set_val_default("osd_memory_target", stringify(def));
+ }
+ }
+
ceph_assert(bdev);
cache_autotune = cct->_conf.get_val<bool>("bluestore_cache_autotune");
cache_autotune_interval =