From: Casey Bodley Date: Tue, 12 Nov 2019 20:08:51 +0000 (-0500) Subject: rgw: beast frontend uses 512k mprotected coroutine stacks X-Git-Tag: v14.2.22~22^2~5^2~1^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ba6d98f047093229f9c30f69c2d61ce11ca008dc;p=ceph.git rgw: beast frontend uses 512k mprotected coroutine stacks Signed-off-by: Casey Bodley (cherry picked from commit 3af8231cab07b731a2d5158a1aa9ec6b524158da) Signed-off-by: Mauricio Faria de Oliveira --- diff --git a/src/rgw/rgw_asio_frontend.cc b/src/rgw/rgw_asio_frontend.cc index 5b59d17ef666..c27ae7da1c56 100644 --- a/src/rgw/rgw_asio_frontend.cc +++ b/src/rgw/rgw_asio_frontend.cc @@ -8,6 +8,7 @@ #include #include +#include #include #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 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()); } }