From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Return-Path: Message-Id: <20190302130033.973773537@gmail.com> Date: Sat, 02 Mar 2019 15:55:26 +0300 From: Cyrill Gorcunov Subject: [rfc 2/4] core/fiber: Mark stack as unneeded on creation References: <20190302125524.279852704@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline; filename=fiber-madvise-stack To: tarantool-patches@freelists.org Cc: gorcunov@gmail.com, vdavydov.dev@gmail.com List-ID: Since we've increased the default stack size we hope the whole 256K 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 in next patches since it doesn't depend on this change. Closes #3418 --- src/lib/core/fiber.c | 7 +++++++ 1 file changed, 7 insertions(+) Index: tarantool.git/src/lib/core/fiber.c =================================================================== --- tarantool.git.orig/src/lib/core/fiber.c +++ tarantool.git/src/lib/core/fiber.c @@ -749,6 +749,13 @@ fiber_stack_create(struct fiber *fiber, 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. + */ + madvise(fiber->stack, fiber->stack_size, MADV_DONTNEED); +#endif mprotect(guard, page_size, PROT_NONE); return 0;