From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Return-Path: Date: Mon, 11 Mar 2019 11:31:26 +0300 From: Cyrill Gorcunov Subject: Re: [PATCH 2/2] lib/core/fiber: Mark stack as unneeded on creation Message-ID: <20190311083126.GG10420@uranus.lan> References: <20190307213146.1476-1-gorcunov@gmail.com> <20190307213146.1476-3-gorcunov@gmail.com> <20190311081814.lq3ginhx3rayjwul@esperanza> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190311081814.lq3ginhx3rayjwul@esperanza> To: Vladimir Davydov Cc: tml , Konstantin Osipov List-ID: On Mon, Mar 11, 2019 at 11:18:14AM +0300, Vladimir Davydov wrote: > > 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 > > madvise on fiber creation doesn't make much sense without madvise on > fiber recycling, because fat tasks will quickly fault-in that memory. > I thought you were going to implement stack shrinking to some predefined > size (say, allocate 1 MB max, shrink to 64 KB on recycle if watermark > was overwritten), leaving only dynamic stack sizing for the future (i.e. > estimating the optimal size to do madvise for basing on average fiber > stack usage). Ah. OK, will rework this.