From 05f7294558ef380e2d9fd2deb848be2570a07854 Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Fri, 26 Feb 2021 17:16:11 +0300 Subject: [PATCH] os/bluestore: go beyond pinned onodes while trimming the cache. One might face lack of cache trimming when there is a bunch of pinned entries on the top of Onode's cache LRU list. If these pinned entries stay in the state for a long time cache might start using too much memory causing OSD to go out of osd-memory-target limit. Pinned state tend to happen to osdmap onodes. The proposed patch preserves last trim position in the LRU list (if it pointed to a pinned entry) and proceeds trimming from that position if it wasn't invalidated. LRU nature of the list enables to do that safely since no new entries appear above the previously present entry while it's not touched. Fixes: https://tracker.ceph.com/issues/48729 Signed-off-by: Igor Fedotov --- src/common/legacy_config_opts.h | 1 + src/common/options.cc | 6 +- src/os/bluestore/BlueStore.cc | 38 +++++--- src/os/bluestore/BlueStore.h | 23 ++++- src/test/objectstore/store_test.cc | 138 +++++++++++++++++++++++++++++ 5 files changed, 188 insertions(+), 18 deletions(-) diff --git a/src/common/legacy_config_opts.h b/src/common/legacy_config_opts.h index 430ef684848..37629afd159 100644 --- a/src/common/legacy_config_opts.h +++ b/src/common/legacy_config_opts.h @@ -1075,6 +1075,7 @@ OPTION(bluestore_default_buffered_write, OPT_BOOL) OPTION(bluestore_debug_misc, OPT_BOOL) OPTION(bluestore_debug_no_reuse_blocks, OPT_BOOL) OPTION(bluestore_debug_small_allocations, OPT_INT) +OPTION(bluestore_debug_max_cached_onodes, OPT_INT) OPTION(bluestore_debug_too_many_blobs_threshold, OPT_INT) OPTION(bluestore_debug_freelist, OPT_BOOL) OPTION(bluestore_debug_prefill, OPT_FLOAT) diff --git a/src/common/options.cc b/src/common/options.cc index c0c9f06ab17..c769bd0bc16 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -4914,7 +4914,11 @@ std::vector