mirror of
https://github.com/ceph/ceph
synced 2025-01-19 01:21:49 +00:00
osd: Change PG Deletion cost for mClock
With the osd_delete_sleep_ssd and osd_delete_sleep_hdd options disabled with mClock, it was noticed that PG deletion was completing much faster with mClock scheduler. In order to give mClock a more accurate cost of the PG Deletion operation, we calculate it by taking into consideration how many objects are being deleted. Signed-off-by: Aishwarya Mathuria <amathuri@redhat.com>
This commit is contained in:
parent
000188f2ba
commit
34bed3e36a
@ -1875,14 +1875,21 @@ void OSDService::queue_scrub_next_chunk(PG *pg, Scrub::scrub_prio_t with_priorit
|
||||
queue_scrub_event_msg<PGScrubGetNextChunk>(pg, with_priority);
|
||||
}
|
||||
|
||||
void OSDService::queue_for_pg_delete(spg_t pgid, epoch_t e)
|
||||
void OSDService::queue_for_pg_delete(spg_t pgid, epoch_t e, int64_t num_objects)
|
||||
{
|
||||
dout(10) << __func__ << " on " << pgid << " e " << e << dendl;
|
||||
uint64_t cost_for_queue = [this, num_objects] {
|
||||
if (op_queue_type_t::mClockScheduler == osd->osd_op_queue_type()) {
|
||||
return num_objects * cct->_conf->osd_pg_delete_cost;
|
||||
} else {
|
||||
return cct->_conf->osd_pg_delete_cost;
|
||||
}
|
||||
}();
|
||||
enqueue_back(
|
||||
OpSchedulerItem(
|
||||
unique_ptr<OpSchedulerItem::OpQueueable>(
|
||||
new PGDelete(pgid, e)),
|
||||
cct->_conf->osd_pg_delete_cost,
|
||||
cost_for_queue,
|
||||
cct->_conf->osd_pg_delete_priority,
|
||||
ceph_clock_now(),
|
||||
0,
|
||||
@ -10220,7 +10227,7 @@ void OSD::maybe_override_cost_for_qos()
|
||||
// If the scheduler enabled is mclock, override the default PG deletion cost
|
||||
// so that mclock can meet the QoS goals.
|
||||
if (op_queue_type_t::mClockScheduler == osd_op_queue_type()) {
|
||||
uint64_t pg_delete_cost = 15728640;
|
||||
uint64_t pg_delete_cost = 1048576;
|
||||
cct->_conf.set_val("osd_pg_delete_cost", std::to_string(pg_delete_cost));
|
||||
}
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ public:
|
||||
unsigned int qu_priority,
|
||||
Scrub::act_token_t act_token);
|
||||
|
||||
void queue_for_pg_delete(spg_t pgid, epoch_t e);
|
||||
void queue_for_pg_delete(spg_t pgid, epoch_t e, int64_t num_objects);
|
||||
bool try_finish_pg_delete(PG *pg, unsigned old_pg_num);
|
||||
|
||||
private:
|
||||
|
@ -2665,7 +2665,8 @@ void PG::C_DeleteMore::complete(int r) {
|
||||
ceph_assert(r == 0);
|
||||
pg->lock();
|
||||
if (!pg->pg_has_reset_since(epoch)) {
|
||||
pg->osd->queue_for_pg_delete(pg->get_pgid(), epoch);
|
||||
pg->osd->queue_for_pg_delete(pg->get_pgid(), epoch,
|
||||
num_objects);
|
||||
}
|
||||
pg->unlock();
|
||||
delete this;
|
||||
@ -2689,7 +2690,9 @@ std::pair<ghobject_t, bool> PG::do_delete_work(
|
||||
std::scoped_lock locker{*this};
|
||||
delete_needs_sleep = false;
|
||||
if (!pg_has_reset_since(e)) {
|
||||
osd->queue_for_pg_delete(get_pgid(), e);
|
||||
// We pass 1 for num_objects here as only wpq uses this code path
|
||||
// and it will be ignored
|
||||
osd->queue_for_pg_delete(get_pgid(), e, 1);
|
||||
}
|
||||
});
|
||||
|
||||
@ -2762,7 +2765,7 @@ std::pair<ghobject_t, bool> PG::do_delete_work(
|
||||
bool running = true;
|
||||
if (num) {
|
||||
dout(20) << __func__ << " deleting " << num << " objects" << dendl;
|
||||
Context *fin = new C_DeleteMore(this, get_osdmap_epoch());
|
||||
Context *fin = new C_DeleteMore(this, get_osdmap_epoch(), num);
|
||||
t.register_on_commit(fin);
|
||||
} else {
|
||||
if (cct->_conf->osd_inject_failure_on_pg_removal) {
|
||||
|
@ -776,7 +776,9 @@ public:
|
||||
struct C_DeleteMore : public Context {
|
||||
PGRef pg;
|
||||
epoch_t epoch;
|
||||
C_DeleteMore(PG *p, epoch_t e) : pg(p), epoch(e) {}
|
||||
int64_t num_objects;
|
||||
C_DeleteMore(PG *p, epoch_t e, int64_t num) : pg(p), epoch(e),
|
||||
num_objects(num){}
|
||||
void finish(int r) override {
|
||||
ceph_abort();
|
||||
}
|
||||
|
@ -12849,7 +12849,9 @@ void PrimaryLogPG::on_removal(ObjectStore::Transaction &t)
|
||||
|
||||
on_shutdown();
|
||||
|
||||
t.register_on_commit(new C_DeleteMore(this, get_osdmap_epoch()));
|
||||
// starting PG deletion, num_objects can be 1
|
||||
// do_delete_work will update num_objects
|
||||
t.register_on_commit(new C_DeleteMore(this, get_osdmap_epoch(), 1));
|
||||
}
|
||||
|
||||
void PrimaryLogPG::clear_async_reads()
|
||||
|
Loading…
Reference in New Issue
Block a user