Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: tml <tarantool-patches@freelists.org>
Subject: Re: [PATCH 3/3] lib/core/fiber: Put watermarks into stack to track its usage
Date: Wed, 13 Mar 2019 17:17:24 +0300	[thread overview]
Message-ID: <20190313141724.wgt5xt3ey2shmtlo@esperanza> (raw)
In-Reply-To: <20190313140054.GO10420@uranus.lan>

On Wed, Mar 13, 2019 at 05:00:54PM +0300, Cyrill Gorcunov wrote:
> > > +
> > > +	if (!stack_has_wmark(fiber->stack_overflow_wmark)) {
> > > +		say_warn("stack usage is close to the limit of %zu bytes",
> > > +			 (size_t)FIBER_STACK_SIZE_DEFAULT);
> > 
> > IMO warning only when we are close to the limit isn't very useful.
> > Let's keep track of the max stack size instead and print it whenever
> > it's increased.
> 
> Could you please elaborate. I don't understand what you mean by
> keep tracking of max stack size. You propose to remember somewhere
> if this mark has been vanished?

Yeah, keep track of the max recorded stack size in a static variable
and keep advancing the higher watermark position whenever it gets
overwritten so that we can report max stack size used:

  I> max stack size is 73728 bytes
  ...
  I> max stack size is 112640 bytes

(the wording might need polishing)

> > > @@ -927,8 +1090,12 @@ cord_create(struct cord *cord, const char *name)
> > >  	/* Record stack extents */
> > >  	tt_pthread_attr_getstack(cord->id, &cord->sched.stack,
> > >  				 &cord->sched.stack_size);
> > > +	cord->sched.stack_overflow_wmark = cord->sched.stack;
> > > +	cord->sched.stack_shrink_wmark = cord->sched.stack;
> > 
> > I don't think we need to set the watermarks for the sched fiber,
> > even if ASAN is on.
> 
> Won't they left unitialized then? The only reason I put nils here
> is to force them have known values even if they are unused.

I'd set them to NULLs for both cases, i.e. outside ifdef.

  reply	other threads:[~2019-03-13 14:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-12 22:47 [PATCH v5 0/2] lib/core/fiber: Increase default stack size Cyrill Gorcunov
2019-03-12 22:47 ` [PATCH 1/3] " Cyrill Gorcunov
2019-03-13 13:42   ` Vladimir Davydov
2019-03-13 13:53     ` Cyrill Gorcunov
2019-03-13 14:13       ` Vladimir Davydov
2019-03-12 22:47 ` [PATCH 2/3] lib/core/fiber: Mark stack as unneeded on creation Cyrill Gorcunov
2019-03-12 22:47 ` [PATCH 3/3] lib/core/fiber: Put watermarks into stack to track its usage Cyrill Gorcunov
2019-03-13 13:52   ` Vladimir Davydov
2019-03-13 14:00     ` Cyrill Gorcunov
2019-03-13 14:17       ` Vladimir Davydov [this message]
2019-03-13 16:15         ` Cyrill Gorcunov

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=20190313141724.wgt5xt3ey2shmtlo@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH 3/3] lib/core/fiber: Put watermarks 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