]> git.apps.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>
Tue, 23 May 2023 13:51:13 +0000 (19:21 +0530)
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/common/options/global.yaml.in
src/osd/OSD.cc
src/osd/OSD.h

index bdb415c5de5c313a1c7fcc6723bf829080a3857b..45f8905fa51b68f1b50b8007bfc1b043bce14bda 100644 (file)
@@ -3645,6 +3645,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 c2404ce793b38256d2625660629bd08df7553d14..5bf61fc7879030e7215d73c63321c2a80ff79fd3 100644 (file)
@@ -1750,9 +1750,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));
 }
 
@@ -1763,12 +1762,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_shallow_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 9f8ac6ea7f6afb558f96479237751c8d98367153..fae9a8e2aefdb67d6101ac49d3607462d06ff478 100644 (file)
@@ -605,6 +605,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;