]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/scheduler: simplify qos specific params in OpSchedulerItem
authorSamuel Just <sjust@redhat.com>
Tue, 4 Apr 2023 23:34:17 +0000 (23:34 +0000)
committerSridhar Seshasayee <sseshasa@redhat.com>
Thu, 27 Apr 2023 13:13:45 +0000 (18:43 +0530)
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 <sjust@redhat.com>
src/osd/OSD.cc
src/osd/scheduler/OpSchedulerItem.h

index 7d5f87344f9aa7e2fb74261a142baa23381f5ae9..750923f83e30e69d53f93608ae467a77fd999b10 100644 (file)
@@ -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;
 
index c74722328843d273df65ca32097bc37b38fbac4b..d9b655091569edd72990045d4b58540219c54ce1 100644 (file)
@@ -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()