]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
blk/KernelDevice: Introduce a cap on the number of pending discards 62220/head
authorJoshua Baergen <jbaergen@digitalocean.com>
Wed, 18 Dec 2024 17:27:58 +0000 (10:27 -0700)
committerIgor Fedotov <igor.fedotov@croit.io>
Tue, 11 Mar 2025 10:00:13 +0000 (13:00 +0300)
commit861d327968049ee9c7b931df5f9a3c4dcf7cfbcb
treef89313589e2662ac28641a20a0a2644856ac5a94
parent55fb540837d22e72fc90027247a9af1da1e21cf3
blk/KernelDevice: Introduce a cap on the number of pending discards

Some disks have a discard performance that is too low to keep up with
write workloads. Using async discard in this case will cause the OSD to
run out of capacity due to the number of outstanding discards preventing
allocations from being freed. While sync discard could be used in this
case to cause backpressure, this might have unacceptable performance
implications.

For the most part, as long as enough discards are getting through to a
device, then it will stay trimmed enough to maintain acceptable
performance. Thus, we can introduce a cap on the pending discard count,
ensuring that the queue of allocations to be freed doesn't get too long
while also issuing sufficient discards to disk. The default value of
1000000 has ample room for discard spikes (e.g. from snaptrim); it could
result in multiple minutes of discards being queued up, but at least
it's not unbounded (though if a user really wants unbounded behaviour,
they can choose it by setting the new configuration option to 0).

Fixes: https://tracker.ceph.com/issues/69604
Signed-off-by: Joshua Baergen <jbaergen@digitalocean.com>
(cherry picked from commit 1dee8837959075687ea8a81c4eec2e1c6625e486)
src/blk/kernel/KernelDevice.cc
src/blk/kernel/KernelDevice.h
src/common/options/global.yaml.in