Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tml <tarantool-patches@dev.tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v7 1/2] fiber: set diagnostics at madvise/mprotect failure
Date: Fri, 14 Feb 2020 10:54:16 +0300	[thread overview]
Message-ID: <20200214075416.GS21061@uranus> (raw)
In-Reply-To: <46c82f5e-5e4c-ec4a-b8ce-b999e6a6230c@tarantool.org>

On Fri, Feb 14, 2020 at 12:26:04AM +0100, Vladislav Shpilevoy wrote:
> Thanks for the fixes!
> 
> > @@ -1007,6 +1035,8 @@ fiber_stack_watermark_create(struct fiber *fiber)
> >  static void
> >  fiber_stack_destroy(struct fiber *fiber, struct slab_cache *slabc)
> >  {
> > +	static const int mprotect_flags = PROT_READ | PROT_WRITE;
> > +
> 
> Why is it static? From what I know, when it is static we don't
> have a guarantee, that it won't occupy memory in the .data section.

it is not about memory occupation but rather init it once instead
of doing so during function prologue. It actually depends on compiler
and modern ones would simply optimize this assignment.

Actually there is one hidden idea -- R|W is initial flags the 'small'
uses when allocates memory that's why I mention this variable in
comment.

> Even though here it is clearly not necessary. Wouldn't just const
> be enough? Why was not it possible to leave these flags inlined in
> fiber_mprotect() call? They are not used anywhere else. PROT_NONE,
> for example, is left inlined.

PROT_NONE is special, it is unrelated to 'small'.

	Cyrill

  reply	other threads:[~2020-02-14  7:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13 20:56 [Tarantool-patches] [PATCH v7 0/2] fiber: Handle stack madvise/mprotect errors Cyrill Gorcunov
2020-02-13 20:56 ` [Tarantool-patches] [PATCH v7 1/2] fiber: set diagnostics at madvise/mprotect failure Cyrill Gorcunov
2020-02-13 23:26   ` Vladislav Shpilevoy
2020-02-14  7:54     ` Cyrill Gorcunov [this message]
2020-02-14 22:27       ` Vladislav Shpilevoy
2020-02-15  6:57         ` Cyrill Gorcunov
2020-02-15 15:41           ` Vladislav Shpilevoy
2020-02-15 17:55             ` Cyrill Gorcunov
2020-02-13 20:56 ` [Tarantool-patches] [PATCH v7 2/2] fiber: leak slab if unable to bring prots back Cyrill Gorcunov
2020-02-13 23:26   ` Vladislav Shpilevoy
2020-02-14  8:25     ` Cyrill Gorcunov
2020-02-13 20:57 ` [Tarantool-patches] [PATCH v7 0/2] fiber: Handle stack madvise/mprotect errors Cyrill Gorcunov
2020-02-13 23:26 ` Vladislav Shpilevoy
2020-02-14  7:07   ` 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=20200214075416.GS21061@uranus \
    --to=gorcunov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v7 1/2] fiber: set diagnostics at madvise/mprotect failure' \
    /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