Skip to content

Commit 2727096

Browse files
authored
Merge pull request ceph#51656 from amathuria/wip-amat-mclock-change-default-scrub-cost
osd: Change scrub cost in case of mClock scheduler
2 parents 1b5e1bf + 05848b4 commit 2727096

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
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
@@ -601,6 +601,7 @@ class OSDService : public Scrub::ScrubSchedListener {
601601
/// provided by the executing scrub (i.e. taken from PgScrubber::m_flags)
602602
template <class MSG_TYPE>
603603
void queue_scrub_event_msg(PG* pg, Scrub::scrub_prio_t with_priority);
604+
int64_t get_scrub_cost();
604605

605606
utime_t defer_recovery_until;
606607
uint64_t recovery_ops_active;

src/osd/scheduler/mClockScheduler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
namespace ceph::osd::scheduler {
3535

36-
constexpr double default_min = 1.0;
36+
constexpr double default_min = 0.0;
3737
constexpr double default_max = std::numeric_limits<double>::is_iec559 ?
3838
std::numeric_limits<double>::infinity() :
3939
std::numeric_limits<double>::max();

0 commit comments

Comments
 (0)