On Wed, Feb 10, 2021 at 06:36:07AM -0800, Ian Lance Taylor wrote:
> Rain Mark <rain.by.z...@gmail.com> writes:
> 
> > After enabling -fsplit-stack, dynamic stack expansion of the coroutine
> > is realized, but calling functions without -fsplit-stack will directly
> > expand the space by 1M, which is too wasteful for a system with a large
> > number of coroutines running under the 128K stack size. We hope to give
> > users more control over the size of stack expansion to adapt to
> > more complex scenarios.
> >
> > Apply for more space each time the stack is expanded, which
> > can also reduce the frequency of morestack being called.
> > When calling the non-split function, we do not need additional
> > checks and apply for 1M space.  At this time, we can turn off
> > the conversion of linker to __morestack_non_split.  This is more friendly
> > to a large number of small stack coroutines running below 128K.
> >
> > Later we need to add an option to the gold linker to turn off
> > the __morestack_non_split conversion.
> 
> Why is the new variable thread local?
> 
> At first glance it seems like this might make more sense as a compiler
> option or compiler function attribute, rather than as a function to
> call.  When would you want to dynamically change the value?
> 
> Ian

Thank you very much, sorry for the late reply.

The compiler option is a better way, but considering that
multiple libraries provide different coroutine implementations.
A system may introduce multiple stackfull coroutine implementations.
Setting the thread local variable is mainly to reset this variable when the 
coroutine is switched.
Avoid this parameter conflict in multiple coroutine implementations.

Thanks
Rain

Reply via email to