]> git.apps.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)
committerMauricio Faria de Oliveira <mfo@canonical.com>
Mon, 8 Mar 2021 12:36:37 +0000 (09:36 -0300)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 3af8231cab07b731a2d5158a1aa9ec6b524158da)
Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
src/rgw/rgw_asio_frontend.cc

index 5b59d17ef6661bc80cef3c056cf42a50b048ebd8..c27ae7da1c5689930d1d10a3644d9fbccf7deb82 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"
@@ -35,6 +36,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;
@@ -670,7 +676,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
   {
@@ -684,7 +690,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());
   }
 }