From 3af8231cab07b731a2d5158a1aa9ec6b524158da Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Tue, 12 Nov 2019 15:08:51 -0500 Subject: [PATCH] rgw: beast frontend uses 512k mprotected coroutine stacks Signed-off-by: Casey Bodley --- src/rgw/rgw_asio_frontend.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_asio_frontend.cc b/src/rgw/rgw_asio_frontend.cc index 7896862d0a0..d8b25cf71f2 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()); } } -- 2.39.5