Repository navigation
umbrella: mclock_common, mClockScheduler: Bound high_priority drain to prevent starvation - #72179
Merged
Merged
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]> (cherry picked from commit 5847d11)
…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]> (cherry picked from commit cf5e5db)
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. |
Contributor
Author
|
/config check ok |
Contributor
Author
|
jenkins test make check |
Contributor
Author
|
jenkins test api |
rzarzynski
approved these changes
Sep 29, 2026
Member
|
This PR has been added to umbrella integration testing by pdonnell started 2026-09-29-17:26. |
Member
|
jenkins test make check |
Member
|
jenkins test windows |
Member
|
jenkins test api |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
backport tracker: https://tracker.ceph.com/issues/80429
backport of #71205
parent tracker: https://tracker.ceph.com/issues/69078
this backport was staged using ceph-backport.sh version 16.0.0.6848
find the latest version at https://github.com/ceph/ceph/blob/main/src/script/ceph-backport.sh