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: v15.1.0~249^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3af8231cab07b731a2d5158a1aa9ec6b524158da;p=ceph.git rgw: beast frontend uses 512k mprotected coroutine stacks Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_asio_frontend.cc b/src/rgw/rgw_asio_frontend.cc index 7896862d0a00..d8b25cf71f23 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" @@ -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 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()); } }