From d5d7ab57d521351d1eb57f6c38847ad9ba6ef46f Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 4 Apr 2023 23:34:17 +0000 Subject: [PATCH] osd/scheduler: simplify qos specific params in OpSchedulerItem is_qos_item() was only used in operator<< for OpSchedulerItem. However, it's actually useful to see priority for mclock items since it affects whether it goes into the immediate queues and, for some types, the class. Unconditionally display both class_id and priority. Signed-off-by: Samuel Just --- src/osd/OSD.cc | 3 -- src/osd/scheduler/OpSchedulerItem.h | 45 +++++++++++++---------------- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 9cc10cc3b7b50..eda5d36cf039e 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -11098,9 +11098,6 @@ void OSD::ShardedOpWQ::_enqueue(OpSchedulerItem&& item) { OSDShard* sdata = osd->shards[shard_index]; assert (NULL != sdata); - if (sdata->get_scheduler_type() == "mClockScheduler") { - item.maybe_set_is_qos_item(); - } dout(20) << __func__ << " " << item << dendl; diff --git a/src/osd/scheduler/OpSchedulerItem.h b/src/osd/scheduler/OpSchedulerItem.h index c74722328843d..d9b655091569e 100644 --- a/src/osd/scheduler/OpSchedulerItem.h +++ b/src/osd/scheduler/OpSchedulerItem.h @@ -89,8 +89,20 @@ private: utime_t start_time; uint64_t owner; ///< global id (e.g., client.XXX) epoch_t map_epoch; ///< an epoch we expect the PG to exist in - uint32_t qos_cost; ///< scaled cost calculated by the mclock scheduler - bool qos_item; ///< set to true if item is scheduled by mclock scheduler + + /** + * qos_cost + * + * Set by mClockScheduler iff queued into mclock proper and not the + * high/immediate queues. Represents mClockScheduler's adjusted + * cost value. + */ + uint32_t qos_cost = 0; + + /// True iff queued via mclock proper, not the high/immediate queues + bool was_queued_via_mclock() const { + return qos_cost > 0; + } public: OpSchedulerItem( @@ -105,8 +117,7 @@ public: priority(priority), start_time(start_time), owner(owner), - map_epoch(e) - { qos_cost = 0; qos_item = false; } + map_epoch(e) {} OpSchedulerItem(OpSchedulerItem &&) = default; OpSchedulerItem(const OpSchedulerItem &) = delete; OpSchedulerItem &operator=(OpSchedulerItem &&) = default; @@ -149,36 +160,20 @@ public: return qitem->get_scheduler_class(); } - void maybe_set_is_qos_item() { - if (get_scheduler_class() != op_scheduler_class::immediate) { - qos_item = true ; - } - } - - bool is_qos_item() const { - return qos_item; - } - void set_qos_cost(uint32_t scaled_cost) { qos_cost = scaled_cost; } - uint32_t get_qos_cost() const { - return qos_cost; - } - friend std::ostream& operator<<(std::ostream& out, const OpSchedulerItem& item) { out << "OpSchedulerItem(" << item.get_ordering_token() << " " << *item.qitem; - if (item.is_qos_item()) { - out << " class_id " << item.get_scheduler_class(); - } else { - out << " prio " << item.get_priority(); - } + out << " class_id " << item.get_scheduler_class(); + + out << " prio " << item.get_priority(); - if (item.get_qos_cost()) { - out << " qos_cost " << item.get_qos_cost(); + if (item.was_queued_via_mclock()) { + out << " qos_cost " << item.qos_cost; } out << " cost " << item.get_cost() -- 2.39.5