From: Samuel Just Date: Tue, 4 Apr 2023 23:34:17 +0000 (+0000) Subject: osd/scheduler: simplify qos specific params in OpSchedulerItem X-Git-Tag: v18.1.0~122^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c2cc638273b8220ce5dd10cde73b39b3ad4c194b;p=ceph.git 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 --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 7d5f87344f9aa..750923f83e30e 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()