From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Return-Path: From: Cyrill Gorcunov Subject: [PATCH 2/2] lib/core/fiber: Mark stack as unneeded on creation Date: Fri, 8 Mar 2019 00:31:46 +0300 Message-Id: <20190307213146.1476-3-gorcunov@gmail.com> In-Reply-To: <20190307213146.1476-1-gorcunov@gmail.com> References: <20190307213146.1476-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: tml Cc: Vladimir Davydov , Konstantin Osipov , Cyrill Gorcunov List-ID: Since we've increased the default stack size we hope the whole 512K won't be used for regular loads thus we mark the stack area as unneeded to minimize rss pressure. Note we do this on fiber creation at the moment, more detailed stack usage analisys will be implemented in another patch series later. Closes #3418 --- src/lib/core/fiber.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib/core/fiber.c b/src/lib/core/fiber.c index f16ac873f..a1b261ad4 100644 --- a/src/lib/core/fiber.c +++ b/src/lib/core/fiber.c @@ -749,6 +749,14 @@ fiber_stack_create(struct fiber *fiber, size_t stack_size) fiber->stack_id = VALGRIND_STACK_REGISTER(fiber->stack, (char *)fiber->stack + fiber->stack_size); +#ifndef TARGET_OS_DARWIN + /* + * We don't expect the whole stack usage in regular + * loads, lets try to minimize rss pressure if OS + * allows us. + */ + madvise(fiber->stack, fiber->stack_size, MADV_DONTNEED); +#endif mprotect(guard, page_size, PROT_NONE); return 0; -- 2.20.1