]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
blk/KernelDevice: Introduce a cap on the number of pending discards 62221/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:11:53 +0000 (13:11 +0300)
commit37e1e723a93dc2d3da2e36f971baa9e3f4311534
treed2929bed9dd2095df22c67488b7744968243a281
parent2610c4ab0062cc2e25369b42057ff66b8dab0033
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