From cf5df7c443aff68f54e3c0ff5b222957ee0fc036 Mon Sep 17 00:00:00 2001 From: Aishwarya Mathuria Date: Thu, 23 Mar 2023 18:49:56 +0530 Subject: [PATCH] mClockScheduler: Set priority cutoff in the mClock Scheduler We check the priority of an op before deciding if it gets enqueued in the high_priority_queue or the mClock scheduler queue. Instead of checking what osd_op_queue_cut_off is set to each time, we should be checking the cutoff only once and set that as the priority_cutoff. This will avoid any issues when osd_op_queue_cut_off is set to debug_random. Fixes: https://tracker.ceph.com/issues/58940 Signed-off-by: Aishwarya Mathuria --- src/osd/scheduler/mClockScheduler.cc | 6 ++---- src/osd/scheduler/mClockScheduler.h | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/osd/scheduler/mClockScheduler.cc b/src/osd/scheduler/mClockScheduler.cc index 5f2edfab1f17a..079e41ea1d11d 100644 --- a/src/osd/scheduler/mClockScheduler.cc +++ b/src/osd/scheduler/mClockScheduler.cc @@ -386,12 +386,11 @@ void mClockScheduler::enqueue(OpSchedulerItem&& item) { auto id = get_scheduler_id(item); unsigned priority = item.get_priority(); - unsigned cutoff = get_io_prio_cut(cct); // TODO: move this check into OpSchedulerItem, handle backwards compat if (op_scheduler_class::immediate == id.class_id) { enqueue_high(immediate_class_priority, std::move(item)); - } else if (priority >= cutoff) { + } else if (priority >= cutoff_priority) { enqueue_high(priority, std::move(item)); } else { auto cost = calc_scaled_cost(item.get_cost()); @@ -424,12 +423,11 @@ void mClockScheduler::enqueue(OpSchedulerItem&& item) void mClockScheduler::enqueue_front(OpSchedulerItem&& item) { unsigned priority = item.get_priority(); - unsigned cutoff = get_io_prio_cut(cct); auto id = get_scheduler_id(item); if (op_scheduler_class::immediate == id.class_id) { enqueue_high(immediate_class_priority, std::move(item), true); - } else if (priority >= cutoff) { + } else if (priority >= cutoff_priority) { enqueue_high(priority, std::move(item), true); } else { // mClock does not support enqueue at front, so we use diff --git a/src/osd/scheduler/mClockScheduler.h b/src/osd/scheduler/mClockScheduler.h index fc2f79b8cd7bc..5c443e66b0004 100644 --- a/src/osd/scheduler/mClockScheduler.h +++ b/src/osd/scheduler/mClockScheduler.h @@ -197,6 +197,8 @@ class mClockScheduler : public OpScheduler, md_config_obs_t { } } + unsigned cutoff_priority = get_io_prio_cut(cct); + /** * set_osd_capacity_params_from_config * @@ -214,7 +216,7 @@ class mClockScheduler : public OpScheduler, md_config_obs_t { // Set the mclock related config params based on the profile void set_config_defaults_from_profile(); -public: +public: mClockScheduler(CephContext *cct, int whoami, uint32_t num_shards, int shard_id, bool is_rotational, MonClient *monc); ~mClockScheduler() override;