From 41eb65785ddb9315d5272b42981e969302c749db Mon Sep 17 00:00:00 2001 From: Aishwarya Mathuria Date: Tue, 20 Sep 2022 19:55:59 +0530 Subject: [PATCH] osd: Change default value of osd_pg_delete_cost osd_pg_delete_cost defines the cost of the PG deletion operation. This cost is used by WPQ to determine which operation should be dequeued. Lower the cost, higher the chance of the operation being dequeued next. mClock scheduler uses the cost parameter in a similar way. However, with the osd_delete_sleep_ssd and osd_delete_sleep_hdd options disabled with mClock, we noticed that PG deletion was completing much faster with mClock scheduler. In order to achieve behavior similar to WPQ with mClock scheduler, the osd_pg_delete_cost has been increased. Signed-off-by: Aishwarya Mathuria --- src/osd/OSD.cc | 15 +++++++++++++++ src/osd/OSD.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 9a7e04a7d2d..0aa66414721 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -3886,6 +3886,7 @@ int OSD::init() // Override a few options if mclock scheduler is enabled. maybe_override_sleep_options_for_qos(); + maybe_override_cost_for_qos(); maybe_override_options_for_qos(); maybe_override_max_osd_capacity_for_qos(); @@ -9670,6 +9671,9 @@ void OSD::handle_conf_change(const ConfigProxy& conf, changed.count("osd_recovery_sleep_hybrid")) { maybe_override_sleep_options_for_qos(); } + if (changed.count("osd_pg_delete_cost")) { + maybe_override_cost_for_qos(); + } if (changed.count("osd_min_recovery_priority")) { service.local_reserver.set_min_priority(cct->_conf->osd_min_recovery_priority); service.remote_reserver.set_min_priority(cct->_conf->osd_min_recovery_priority); @@ -9982,6 +9986,17 @@ void OSD::maybe_override_sleep_options_for_qos() } } +void OSD::maybe_override_cost_for_qos() +{ + // If the scheduler enabled is mclock, override the default PG deletion cost + // so that mclock can meet the QoS goals. + if (cct->_conf.get_val("osd_op_queue") == "mclock_scheduler" && + !unsupported_objstore_for_qos()) { + uint64_t pg_delete_cost = 15728640; + cct->_conf.set_val("osd_pg_delete_cost", std::to_string(pg_delete_cost)); + } +} + /** * A context for receiving status from a background mon command to set * a config option and optionally apply the changes on each op shard. diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 938860fcafe..2b04ad3516d 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -2024,6 +2024,7 @@ private: void maybe_override_sleep_options_for_qos(); bool maybe_override_options_for_qos( const std::set *changed = nullptr); + void maybe_override_cost_for_qos(); int run_osd_bench_test(int64_t count, int64_t bsize, int64_t osize,