Skip to content

Commit

Permalink
mClockScheduler: Set priority cutoff in the mClock Scheduler
Browse files Browse the repository at this point in the history
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 <amathuri@redhat.com>
  • Loading branch information
amathuria authored and Aishwarya Mathuria committed May 9, 2023
1 parent 785f3ec commit cf5df7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/osd/scheduler/mClockScheduler.cc
Expand Up @@ -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());
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/osd/scheduler/mClockScheduler.h
Expand Up @@ -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
*
Expand All @@ -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;
Expand Down

0 comments on commit cf5df7c

Please sign in to comment.