Repository navigation
mclock_common, mClockScheduler: Bound high_priority drain to prevent starvation - #71205
Conversation
…starvation Under sustained client I/O on EC pools, mClockScheduler::dequeue() drains the strict-priority high_priority queue (immediate class, e.g. client-driven EC subop reads/writes/replies) unconditionally before ever calling scheduler.pull_request(), the entry point that services mClock managed queue items. Since high_priority can stay continuously non-empty under heavy load, this can starve mClock managed queue items -- in the trackers case most visibly deep-scrub's chunk-continuation events (PGScrubGetNextChunk, PGScrubChunkIsFree, PGScrubResched, etc.) -- for tens of seconds at a time, regardless of their configured mclock reservation. Add a bounded check: once the mclock-managed queue has gone unserviced for osd_mclock_max_starve_time while high_priority keeps refilling, force one dequeue attempt from it before resuming the high_priority drain. No-op when the mclock queue is empty, so normal operation is unaffected. Bound the starvation window on flash to 50ms via an internal constant -- scheduler_max_starve_time_ssd, and not a configuration option as this was tested on real hardware. But since no HDD test hardware has been available for this investigation, rather than ship an unvalidated hardcoded constant with no adjustment path, a configurable called osd_mclock_max_starve_time_hdd is introduced. Default 0.25s, bounded to [0.1s, 0.5s]. A modern 7200 RPM HDD's average random-access time is roughly 10-15ms, so the configurable range remains a real, meaningful multiple of that even at the tightest allowed setting. This allows an operator some flexibility in case a given HDD fleet needs a different value. Tests (src/test/osd/TestMClockScheduler.cc): Add Unit Tests to exercise the starvation logic for SSD and HDD. Documentation (doc/rados/configuration/mclock-config-ref.rst): Add a new "mClock Queue Starvation Prevention" section explaining the immediate/high-priority-vs-mclock-managed-queue starvation mechanism, the bounded forced-yield fix, the device-aware threshold split and add osd_mclock_max_starve_time_hdd to the list of config options. Fixes: https://tracker.ceph.com/issues/69078 Signed-off-by: Sridhar Seshasayee <[email protected]>
Config Diff Tool Output+ added: osd_mclock_max_starve_time_hdd (osd.yaml.in)
The above configuration changes are found in the PR. Please update the relevant release documentation if necessary. |
|
Test Report - Discusses results from more in-depth testing on a node with NVMe hardware. |
|
jenkins test api |
|
/config check ok |
|
jenkins test api |
| The threshold is device-aware because the same absolute value does not make | ||
| sense across device types: a rotational op's own natural per-op service time |
| mclock_conf.put_mclock_counter(retn.client, op_type, time_queued); | ||
| last_mclock_service_time = crimson::dmclock::get_time(); | ||
|
|
||
| return std::move(*retn.request); |
|
This PR has been added to wip-bharath14-testing-20260826.230942-main. |
|
Re-working the PR as teuthology tests show that there's an issue with handling requeued ops. I will update more details soon. |
@rzarzynski A second commit (title: mClockScheduler: Reserve a requeued-item prio queue to prevent op-order aborts) is added that resolves the requeued ops issue. A subset of following teuthology tests that were failing before due to the requeued ops being scheduled out-of-order are now passing with the fix. See https://pulpito.ceph.com/sseshasa-2026-09-03_09:48:01-rados-wip-sseshasa-71205-req_testing-2026-09-03-distro-default-trial/. The sole failure in the run is unrelated to the fix and is a known issue. Please review the above mentioned commit when possible. The first commit you reviewed earlier remains unchanged. Thanks! |
…er aborts The starvation-bound forced yield added to dequeue() could let a client-class item still sitting in the mclock-managed queue get scheduled ahead of a same-client item that had been pulled out of its normal queue position via enqueue_front() (PG map-wait release, rwordered-dependency requeue, or a PG-slot wake). In other words, this is a requeued item now in the high_priority queue. enqueue_front() has no way to preserve such an item's position relative to same-client siblings still in the mclock queue, since mClock does not support inserting at the front of its own queue. So the item would be redirected into high_priority instead, where a forced yield due to starvation could release its sibling first, producing a client visible tid inversion and resulting in "bad op order" abort. Fix: Give client class items enqueued via enqueue_front() a reserved high_priority queue (requeued_class_priority, set to SchedulerClass::client's own value purely so it documents itself) instead of priority 0, and gate the starvation-bound forced yield so it never pulls from the mclock-managed queue while requeued class priority queue is non-empty. The other high_priority queues(MAX, >=cutoff_priority) and their drain remain unchanged. The usage of the requeued-item high priority queue is scoped only for client items that get requeued via enqueue_front(). Other classes like background-recovery / background-best-effort that are not bound by tid-ordering invariant get requeued as before in the priority 0 queue. Gating the force yield on the presence of requeued client ops is expected to be rare and bursty rather than sustained and therefore is not expected to dilute the effectiveness of the starvation mechanism. Tests: src/test/osd/TestMclockScheduler.cc - Add unit tests to validate the requeued_class_priority mechanics and maintaining op order invariant. Fixes: https://tracker.ceph.com/issues/69078 Signed-off-by: Sridhar Seshasayee <[email protected]>
b8871be to
cf5e5db
Compare
|
This PR has been removed from wip-bharath14-testing-20260826.230942-main. |
|
This PR has been added to wip-bharath12-testing-20260907.061609-main. |
Background & Changes:
Tests (src/test/osd/TestMClockScheduler.cc):
requeued_class_priorityqueue mechanics and maintaining op order invariant.Documentation (doc/rados/configuration/mclock-config-ref.rst): Add a new "mClock Queue Starvation Prevention" section explaining the immediate/high-priority-vs-mclock-managed-queue starvation mechanism, the bounded forced-yield fix, the device-aware threshold split and add osd_mclock_max_starve_time_hdd to the list of config options.
Test Report - Discusses results from more in-depth testing on a node with NVMe hardware.
Fixes: https://tracker.ceph.com/issues/69078
Signed-off-by: Sridhar Seshasayee [email protected]
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.