]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
blk: don't cache the huge page-based buffers of KernelDevice.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Mon, 8 Nov 2021 20:09:19 +0000 (20:09 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 12 Jan 2022 20:35:50 +0000 (20:35 +0000)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/blk/kernel/KernelDevice.cc
src/blk/kernel/KernelDevice.h

index 62f91fa7bc8705bd1f694c436af8161ab8c32b7e..7a0d90b449c85a6881022609d4340e94f059073c 100644 (file)
@@ -1170,7 +1170,8 @@ HugePagePoolOfPools HugePagePoolOfPools::from_desc(const std::string& desc) {
 // create a buffer basing on user-configurable. it's intended to make
 // our buffers THP-able.
 ceph::unique_leakable_ptr<buffer::raw> KernelDevice::create_custom_aligned(
-  const size_t len) const
+  const size_t len,
+  IOContext* const ioc) const
 {
   // just to preserve the logic of create_small_page_aligned().
   if (len < CEPH_PAGE_SIZE) {
@@ -1185,6 +1186,7 @@ ceph::unique_leakable_ptr<buffer::raw> KernelDevice::create_custom_aligned(
               << " bdev_read_preallocated_huge_buffers="
               << cct->_conf.get_val<std::string>("bdev_read_preallocated_huge_buffers")
               << dendl;
+      ioc->flags |= IOContext::FLAG_DONT_CACHE;
       return lucky_raw;
     } else {
       // fallthrough due to empty buffer pool. this can happen also
@@ -1214,7 +1216,7 @@ int KernelDevice::read(uint64_t off, uint64_t len, bufferlist *pbl,
 
   auto start1 = mono_clock::now();
 
-  auto p = ceph::buffer::ptr_node::create(create_custom_aligned(len));
+  auto p = ceph::buffer::ptr_node::create(create_custom_aligned(len, ioc));
   int r = ::pread(choose_fd(buffered,  WRITE_LIFE_NOT_SET),
                  p->c_str(), len, off);
   auto age = cct->_conf->bdev_debug_aio_log_age;
@@ -1266,7 +1268,7 @@ int KernelDevice::aio_read(
     ++ioc->num_pending;
     aio_t& aio = ioc->pending_aios.back();
     aio.bl.push_back(
-      ceph::buffer::ptr_node::create(create_custom_aligned(len)));
+      ceph::buffer::ptr_node::create(create_custom_aligned(len, ioc)));
     aio.bl.prepare_iov(&aio.iov);
     aio.preadv(off, len);
     dout(30) << aio << dendl;
index 14d9a470117d16adeb926ac0fb9d43749efaa633..613a9bbfed9e4229d5a866a547d1b93e3aa03635 100644 (file)
@@ -112,7 +112,7 @@ private:
   void _detect_vdo();
   int choose_fd(bool buffered, int write_hint) const;
 
-  ceph::unique_leakable_ptr<buffer::raw> create_custom_aligned(size_t len) const;
+  ceph::unique_leakable_ptr<buffer::raw> create_custom_aligned(size_t len, IOContext* ioc) const;
 
 public:
   KernelDevice(CephContext* cct, aio_callback_t cb, void *cbpriv, aio_callback_t d_cb, void *d_cbpriv);