]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: beast frontend uses 512k mprotected coroutine stacks
authorCasey Bodley <cbodley@redhat.com>
Tue, 12 Nov 2019 20:08:51 +0000 (15:08 -0500)
committerCasey Bodley <cbodley@redhat.com>
Wed, 8 Jan 2020 16:31:04 +0000 (11:31 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_asio_frontend.cc

index 7896862d0a004f496a6cf0b9a7ed4ee197dd05bf..d8b25cf71f23a25ec769ada95c79796b84315886 100644 (file)
@@ -8,6 +8,7 @@
 #include <boost/asio.hpp>
 #include <boost/intrusive/list.hpp>
 
+#include <boost/context/protected_fixedsize_stack.hpp>
 #include <spawn/spawn.hpp>
 
 #include "common/async/shared_mutex.h"
@@ -34,6 +35,11 @@ namespace ssl = boost::asio::ssl;
 
 using parse_buffer = boost::beast::flat_static_buffer<65536>;
 
+// use mmap/mprotect to allocate 512k coroutine stacks
+auto make_stack_allocator() {
+  return boost::context::protected_fixedsize_stack{512*1024};
+}
+
 template <typename Stream>
 class StreamIO : public rgw::asio::ClientIO {
   CephContext* const cct;
@@ -615,7 +621,7 @@ void AsioFrontend::accept(Listener& l, boost::system::error_code ec)
           stream.async_shutdown(yield[ec]);
         }
         s.shutdown(tcp::socket::shutdown_both, ec);
-      });
+      }, make_stack_allocator());
   } else {
 #else
   {
@@ -629,7 +635,7 @@ void AsioFrontend::accept(Listener& l, boost::system::error_code ec)
         handle_connection(context, env, s, *buffer, false, pause_mutex,
                           scheduler.get(), ec, yield);
         s.shutdown(tcp::socket::shutdown_both, ec);
-      });
+      }, make_stack_allocator());
   }
 }