]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Change scrub cost in case of mClock scheduler
authorAishwarya Mathuria <amathuri@redhat.com>
Fri, 19 May 2023 11:46:11 +0000 (17:16 +0530)
committerAishwarya Mathuria <amathuri@redhat.com>
Thu, 25 May 2023 02:55:15 +0000 (02:55 +0000)
With osd_op_queue as WPQ, high costs were assigned to scrub in order to throttle it effectively.
In the case of mClock scheduler, mClock parameters are used to do the throttling and the cost should represent a realistic value.

Fixes: https://tracker.ceph.com/issues/61313
Signed-off-by: Aishwarya Mathuria <amathuri@redhat.com>
(cherry picked from commit 43544d296c5fc14aaf638ddf21de9ea9d99f6059)

src/osd/OSD.cc: We are using osd_scrub_chunk_max in the scrub cost calculation here.

src/common/options/global.yaml.in
src/osd/OSD.cc
src/osd/OSD.h

index 18890f2c8492c3f885c9fe508f92134ed1d4636c..a0ebf3576c9bfc88f2d98d1069696dcab28e73d2 100644 (file)
@@ -3620,6 +3620,12 @@ options:
   desc: Cost for scrub operations in work queue
   default: 50_M
   with_legacy: true
+- name: osd_scrub_event_cost
+  type: size
+  level: advanced
+  desc: Cost for each scrub operation, used when osd_op_queue=mclock_scheduler
+  default: 4_K
+  with_legacy: true
 # set requested scrub priority higher than scrub priority to make the
 # requested scrubs jump the queue of scheduled scrubs
 - name: osd_requested_scrub_priority
index 6a7660531ee8c2093c6cb1b16bf3dd839714f81e..267aa031d3d6ff6ec722eb9733aa098beddf3d76 100644 (file)
@@ -1694,9 +1694,8 @@ void OSDService::queue_scrub_event_msg(PG* pg,
   auto msg = new MSG_TYPE(pg->get_pgid(), epoch, act_token);
   dout(15) << "queue a scrub event (" << *msg << ") for " << *pg
            << ". Epoch: " << epoch << " token: " << act_token << dendl;
-
   enqueue_back(OpSchedulerItem(
-    unique_ptr<OpSchedulerItem::OpQueueable>(msg), cct->_conf->osd_scrub_cost,
+    unique_ptr<OpSchedulerItem::OpQueueable>(msg), get_scrub_cost(),
     pg->scrub_requeue_priority(with_priority, qu_priority), ceph_clock_now(), 0, epoch));
 }
 
@@ -1707,12 +1706,22 @@ void OSDService::queue_scrub_event_msg(PG* pg,
   const auto epoch = pg->get_osdmap_epoch();
   auto msg = new MSG_TYPE(pg->get_pgid(), epoch);
   dout(15) << "queue a scrub event (" << *msg << ") for " << *pg << ". Epoch: " << epoch << dendl;
-
   enqueue_back(OpSchedulerItem(
-    unique_ptr<OpSchedulerItem::OpQueueable>(msg), cct->_conf->osd_scrub_cost,
+    unique_ptr<OpSchedulerItem::OpQueueable>(msg), get_scrub_cost(),
     pg->scrub_requeue_priority(with_priority), ceph_clock_now(), 0, epoch));
 }
 
+int64_t OSDService::get_scrub_cost()
+{
+
+  int64_t cost_for_queue = cct->_conf->osd_scrub_cost;
+  if (cct->_conf->osd_op_queue == "mclock_scheduler") {
+    cost_for_queue = cct->_conf->osd_scrub_event_cost *
+                     cct->_conf->osd_scrub_chunk_max;
+  }
+  return cost_for_queue;
+}
+
 void OSDService::queue_for_scrub(PG* pg, Scrub::scrub_prio_t with_priority)
 {
   queue_scrub_event_msg<PGScrub>(pg, with_priority);
index c7b55613c400ac5c8faecae72069567bcf05d9a6..571ac99c57da8ab0386ba79a2210999aae2281ff 100644 (file)
@@ -633,6 +633,7 @@ private:
   /// provided by the executing scrub (i.e. taken from PgScrubber::m_flags)
   template <class MSG_TYPE>
   void queue_scrub_event_msg(PG* pg, Scrub::scrub_prio_t with_priority);
+  int64_t get_scrub_cost();
 
   utime_t defer_recovery_until;
   uint64_t recovery_ops_active;