]> git-server-git.apps.pok.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>
Mon, 8 May 2023 09:16:25 +0000 (14:46 +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 2775e8c0b42f78f0cebed4318b8c642c25505b37..84c958acde3b17c55b92fb91bc98fd27ef474286 100644 (file)
@@ -11352,9 +11352,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 9114195dcaedd845b34ba15ed9fdadf6e9edcf64..a60dcb3fbd01f9bef1d5013eed2222ff7fd591c3 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()