[tarantool-patches] [rfc 3/4] core/fiber: Put static watermark into stack to track its usage
Konstantin Osipov
kostja at tarantool.org
Tue Mar 5 11:08:13 MSK 2019
* Cyrill Gorcunov <gorcunov at 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
More information about the Tarantool-patches
mailing list