From: Deepika Upadhyay Date: Wed, 15 Apr 2020 12:01:46 +0000 (+0530) Subject: split mempool allocation for bluestore_cache_other X-Git-Tag: v15.2.9~122^2~66^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5a3d64cd489f9606bd359bfaad26a8fafc38bebe;p=ceph.git split mempool allocation for bluestore_cache_other While doing root cause analysis it bluestore_cache_other gives a bit of a crude estimate, something more helpful would be to have it split into the following fields: - bluestore_cache_onode - bluestore_cache_meta - bluestore_onode_attrs Signed-off-by: Deepika Upadhyay (cherry picked from commit 1c6bc3893bf4cadae344ef19290f5c7e55dd5a62) Conflicts: src/os/bluestore/bluestore_types.h Lacked explicit std:: namespace reference in headers which pacific has --- diff --git a/src/include/mempool.h b/src/include/mempool.h index 8027305688d2..5ad7d8f4eeca 100644 --- a/src/include/mempool.h +++ b/src/include/mempool.h @@ -150,12 +150,15 @@ namespace mempool { f(bluestore_alloc) \ f(bluestore_cache_data) \ f(bluestore_cache_onode) \ + f(bluestore_cache_meta) \ f(bluestore_cache_other) \ f(bluestore_fsck) \ f(bluestore_txc) \ - f(bluestore_writing_deferred) \ + f(bluestore_writing_deferred) \ f(bluestore_writing) \ f(bluefs) \ + f(bluefs_file_reader) \ + f(bluefs_file_writer) \ f(buffer_anon) \ f(buffer_meta) \ f(osd) \ diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 442a93c66bb2..95e5ada42528 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -1699,7 +1699,7 @@ void BlueStore::OnodeSpace::rename( OnodeRef& oldo, const ghobject_t& old_oid, const ghobject_t& new_oid, - const mempool::bluestore_cache_other::string& new_okey) + const mempool::bluestore_cache_meta::string& new_okey) { std::lock_guard l(cache->lock); ldout(cache->cct, 30) << __func__ << " " << old_oid << " -> " << new_oid @@ -3345,7 +3345,7 @@ BlueStore::Onode* BlueStore::Onode::decode( auto p = v.front().begin_deep(); on->onode.decode(p); for (auto& i : on->onode.attrs) { - i.second.reassign_to_mempool(mempool::mempool_bluestore_cache_other); + i.second.reassign_to_mempool(mempool::mempool_bluestore_cache_onode); } // initialize extent_map @@ -3354,7 +3354,7 @@ BlueStore::Onode* BlueStore::Onode::decode( denc(on->extent_map.inline_bl, p); on->extent_map.decode_some(on->extent_map.inline_bl); on->extent_map.inline_bl.reassign_to_mempool( - mempool::mempool_bluestore_cache_other); + mempool::mempool_bluestore_cache_onode); } else { on->extent_map.init_shards(false, false); @@ -10348,7 +10348,7 @@ int BlueStore::getattr( int r; { std::shared_lock l(c->lock); - mempool::bluestore_cache_other::string k(name); + mempool::bluestore_cache_meta::string k(name); OnodeRef o = c->get_onode(oid, false); if (!o || !o->exists) { @@ -14330,10 +14330,10 @@ int BlueStore::_setattr(TransContext *txc, if (val.is_partial()) { auto& b = o->onode.attrs[name.c_str()] = bufferptr(val.c_str(), val.length()); - b.reassign_to_mempool(mempool::mempool_bluestore_cache_other); + b.reassign_to_mempool(mempool::mempool_bluestore_cache_onode); } else { auto& b = o->onode.attrs[name.c_str()] = val; - b.reassign_to_mempool(mempool::mempool_bluestore_cache_other); + b.reassign_to_mempool(mempool::mempool_bluestore_cache_onode); } txc->write_onode(o); dout(10) << __func__ << " " << c->cid << " " << o->oid @@ -14356,10 +14356,10 @@ int BlueStore::_setattrs(TransContext *txc, if (p->second.is_partial()) { auto& b = o->onode.attrs[p->first.c_str()] = bufferptr(p->second.c_str(), p->second.length()); - b.reassign_to_mempool(mempool::mempool_bluestore_cache_other); + b.reassign_to_mempool(mempool::mempool_bluestore_cache_onode); } else { auto& b = o->onode.attrs[p->first.c_str()] = p->second; - b.reassign_to_mempool(mempool::mempool_bluestore_cache_other); + b.reassign_to_mempool(mempool::mempool_bluestore_cache_onode); } } txc->write_onode(o); @@ -14771,7 +14771,7 @@ int BlueStore::_rename(TransContext *txc, << new_oid << dendl; int r; ghobject_t old_oid = oldo->oid; - mempool::bluestore_cache_other::string new_okey; + mempool::bluestore_cache_meta::string new_okey; if (newo) { if (newo->exists) { diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index cac64a08d5df..d6c958b8f28c 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -280,7 +280,7 @@ public: boost::intrusive::list_member_hook<>, &Buffer::state_item> > state_list_t; - mempool::bluestore_cache_other::map> + mempool::bluestore_cache_meta::map> buffer_map; // we use a bare intrusive list here instead of std::map because @@ -469,7 +469,7 @@ public: // we use a bare pointer because we don't want to affect the ref // count - mempool::bluestore_cache_other::unordered_map sb_map; + mempool::bluestore_cache_meta::unordered_map sb_map; SharedBlobRef lookup(uint64_t sbid) { std::lock_guard l(lock); @@ -684,7 +684,7 @@ public: #endif }; typedef boost::intrusive_ptr BlobRef; - typedef mempool::bluestore_cache_other::map blob_map_t; + typedef mempool::bluestore_cache_meta::map blob_map_t; /// a logical extent, pointing to (some portion of) a blob typedef boost::intrusive::set_base_hook > ExtentBase; //making an alias to avoid build warnings @@ -792,7 +792,7 @@ public: bool loaded = false; ///< true if shard is loaded bool dirty = false; ///< true if shard is dirty and needs reencoding }; - mempool::bluestore_cache_other::vector shards; ///< shards + mempool::bluestore_cache_meta::vector shards; ///< shards bufferlist inline_bl; ///< cached encoded map, if unsharded; empty=>dirty @@ -1059,7 +1059,7 @@ public: ghobject_t oid; /// key under PREFIX_OBJ where we are stored - mempool::bluestore_cache_other::string key; + mempool::bluestore_cache_meta::string key; boost::intrusive::list_member_hook<> lru_item; @@ -1081,7 +1081,7 @@ public: ceph::condition_variable flush_cond; ///< wait here for uncommitted txns Onode(Collection *c, const ghobject_t& o, - const mempool::bluestore_cache_other::string& k) + const mempool::bluestore_cache_meta::string& k) : nref(0), c(c), oid(o), @@ -1283,7 +1283,7 @@ public: private: /// forward lookups - mempool::bluestore_cache_other::unordered_map onode_map; + mempool::bluestore_cache_onode::unordered_map onode_map; friend class Collection; // for split_cache() @@ -1299,7 +1299,7 @@ public: OnodeRef lookup(const ghobject_t& o); void rename(OnodeRef& o, const ghobject_t& old_oid, const ghobject_t& new_oid, - const mempool::bluestore_cache_other::string& new_okey); + const mempool::bluestore_cache_meta::string& new_okey); void clear(); bool empty(); @@ -2161,8 +2161,9 @@ private: MetaCache(BlueStore *s) : MempoolCache(s) {}; virtual uint64_t _get_used_bytes() const { - return mempool::bluestore_cache_other::allocated_bytes() + - mempool::bluestore_cache_onode::allocated_bytes(); + return mempool::bluestore_cache_meta::allocated_bytes() + + mempool::bluestore_cache_other::allocated_bytes() + + mempool::bluestore_cache_onode::allocated_bytes(); } virtual string get_cache_name() const { diff --git a/src/os/bluestore/bluestore_types.h b/src/os/bluestore/bluestore_types.h index 7ed4eb7b04de..fb4e023be49e 100644 --- a/src/os/bluestore/bluestore_types.h +++ b/src/os/bluestore/bluestore_types.h @@ -896,7 +896,9 @@ ostream& operator<<(ostream& out, const bluestore_shared_blob_t& o); struct bluestore_onode_t { uint64_t nid = 0; ///< numeric id (locally unique) uint64_t size = 0; ///< object size - map attrs; ///< attrs + // FIXME: bufferptr does not have a mempool + map attrs; +// mempool::bluestore_cache_onode::map attrs; ///< attrs struct shard_info { uint32_t offset = 0; ///< logical offset for start of shard diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index 3e89141b8c13..f0c9ad447f14 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -6436,15 +6436,18 @@ TEST_P(StoreTestSpecificAUSize, TooManyBlobsTest) { #if defined(WITH_BLUESTORE) void get_mempool_stats(uint64_t* total_bytes, uint64_t* total_items) { + uint64_t meta_allocated = mempool::bluestore_cache_meta::allocated_bytes(); uint64_t onode_allocated = mempool::bluestore_cache_onode::allocated_bytes(); uint64_t other_allocated = mempool::bluestore_cache_other::allocated_bytes(); + uint64_t meta_items = mempool::bluestore_cache_meta::allocated_items(); uint64_t onode_items = mempool::bluestore_cache_onode::allocated_items(); uint64_t other_items = mempool::bluestore_cache_other::allocated_items(); - cout << "onode(" << onode_allocated << "/" << onode_items + cout << "meta(" << meta_allocated << "/" << meta_items + << ") onode(" << onode_allocated << "/" << onode_items << ") other(" << other_allocated << "/" << other_items << ")" << std::endl; - *total_bytes = onode_allocated + other_allocated; + *total_bytes = meta_allocated + onode_allocated + other_allocated; *total_items = onode_items; }