Tarantool development patches archive
 help / color / mirror / Atom feed
From: Konstantin Osipov <kostja@tarantool.org>
To: tarantool-patches@freelists.org
Cc: gorcunov@gmail.com, vdavydov.dev@gmail.com
Subject: Re: [tarantool-patches] [rfc 3/4] core/fiber: Put static watermark into stack to track its usage
Date: Tue, 5 Mar 2019 11:08:13 +0300	[thread overview]
Message-ID: <20190305080813.GJ21955@chai> (raw)
In-Reply-To: <20190302130034.050488016@gmail.com>

* Cyrill Gorcunov <gorcunov@gmail.com> [19/03/03 23:25]:
> We want to detect a situation where task in fiber is too eager for
> stack and close to its exhausting. For this sake upon stack creation
> we put 8 marks on last stack page with step of 128 bytes. Such params
> allows us to fill ~1/4 of a page, which does seem reasonable but
> we might change this params with time.
> 
> Since the watermark position is permanent and some task is close
> to stack limit we print about the situation once to not spam
> a user much and stop putting the mark on recycling.

> +	/*
> +	 * Initially we arm last page of a stack
> +	 * to catch if we're getting close to
> +	 * stack exhausting.
> +	 */
> +	if (stack_direction < 0)
> +		fiber->stack_wmark_ofl = fiber->stack;
> +	else
> +		fiber->stack_wmark_ofl = fiber->stack + fiber->stack_size - page_size;
> +	stack_put_wmark(fiber->stack_wmark_ofl);
> +}

Could you please incorporate some randomness when assigning this
address? A simple pseudo-random number within range 0
..page_size/2 would make me happy.


-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov

  reply	other threads:[~2019-03-05  8:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-02 12:55 [rfc 0/4] fiber/stack: Increase stack size and shrink rss usage Cyrill Gorcunov
2019-03-02 12:55 ` [rfc 1/4] core/fiber: Increase default stack size Cyrill Gorcunov
2019-03-02 12:55 ` [rfc 2/4] core/fiber: Mark stack as unneeded on creation Cyrill Gorcunov
2019-03-02 12:55 ` [rfc 3/4] core/fiber: Put static watermark into stack to track its usage Cyrill Gorcunov
2019-03-05  8:08   ` Konstantin Osipov [this message]
2019-03-05  8:17     ` [tarantool-patches] " Cyrill Gorcunov
2019-03-05  8:10   ` Konstantin Osipov
2019-03-05  8:14     ` Cyrill Gorcunov
2019-03-05 19:17     ` Cyrill Gorcunov
2019-03-05  8:20   ` Konstantin Osipov
2019-03-05  8:27     ` Cyrill Gorcunov
2019-03-02 12:55 ` [rfc 4/4] core/fiber: Shrink stack when recycling Cyrill Gorcunov
2019-03-05  8:30   ` [tarantool-patches] " Konstantin Osipov
2019-03-05  8:41     ` Cyrill Gorcunov
2019-03-05  9:32       ` [tarantool-patches] " Konstantin Osipov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190305080813.GJ21955@chai \
    --to=kostja@tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [tarantool-patches] [rfc 3/4] core/fiber: Put static watermark into stack to track its usage' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox