Skip to content

Commit 43544d2

Browse files
committed
osd: Change scrub cost in case of mClock scheduler
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 <[email protected]>
1 parent 0345083 commit 43544d2

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

src/common/options/global.yaml.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3645,6 +3645,12 @@ options:
36453645
desc: Cost for scrub operations in work queue
36463646
default: 50_M
36473647
with_legacy: true
3648+
- name: osd_scrub_event_cost
3649+
type: size
3650+
level: advanced
3651+
desc: Cost for each scrub operation, used when osd_op_queue=mclock_scheduler
3652+
default: 4_K
3653+
with_legacy: true
36483654
# set requested scrub priority higher than scrub priority to make the
36493655
# requested scrubs jump the queue of scheduled scrubs
36503656
- name: osd_requested_scrub_priority

src/osd/OSD.cc

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,9 +1756,8 @@ void OSDService::queue_scrub_event_msg(PG* pg,
17561756
auto msg = new MSG_TYPE(pg->get_pgid(), epoch, act_token);
17571757
dout(15) << "queue a scrub event (" << *msg << ") for " << *pg
17581758
<< ". Epoch: " << epoch << " token: " << act_token << dendl;
1759-
17601759
enqueue_back(OpSchedulerItem(
1761-
unique_ptr<OpSchedulerItem::OpQueueable>(msg), cct->_conf->osd_scrub_cost,
1760+
unique_ptr<OpSchedulerItem::OpQueueable>(msg), get_scrub_cost(),
17621761
pg->scrub_requeue_priority(with_priority, qu_priority), ceph_clock_now(), 0, epoch));
17631762
}
17641763

@@ -1769,12 +1768,22 @@ void OSDService::queue_scrub_event_msg(PG* pg,
17691768
const auto epoch = pg->get_osdmap_epoch();
17701769
auto msg = new MSG_TYPE(pg->get_pgid(), epoch);
17711770
dout(15) << "queue a scrub event (" << *msg << ") for " << *pg << ". Epoch: " << epoch << dendl;
1772-
17731771
enqueue_back(OpSchedulerItem(
1774-
unique_ptr<OpSchedulerItem::OpQueueable>(msg), cct->_conf->osd_scrub_cost,
1772+
unique_ptr<OpSchedulerItem::OpQueueable>(msg), get_scrub_cost(),
17751773
pg->scrub_requeue_priority(with_priority), ceph_clock_now(), 0, epoch));
17761774
}
17771775

1776+
int64_t OSDService::get_scrub_cost()
1777+
{
1778+
1779+
int64_t cost_for_queue = cct->_conf->osd_scrub_cost;
1780+
if (cct->_conf->osd_op_queue == "mclock_scheduler") {
1781+
cost_for_queue = cct->_conf->osd_scrub_event_cost *
1782+
cct->_conf->osd_shallow_scrub_chunk_max;
1783+
}
1784+
return cost_for_queue;
1785+
}
1786+
17781787
void OSDService::queue_for_scrub(PG* pg, Scrub::scrub_prio_t with_priority)
17791788
{
17801789
queue_scrub_event_msg<PGScrub>(pg, with_priority);

src/osd/OSD.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ class OSDService : public Scrub::ScrubSchedListener {
605605
/// provided by the executing scrub (i.e. taken from PgScrubber::m_flags)
606606
template <class MSG_TYPE>
607607
void queue_scrub_event_msg(PG* pg, Scrub::scrub_prio_t with_priority);
608+
int64_t get_scrub_cost();
608609

609610
utime_t defer_recovery_until;
610611
uint64_t recovery_ops_active;

0 commit comments

Comments
 (0)