All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>, xen-devel@lists.xen.org
Subject: Re: [PATCH] xenstore: set READ_THREAD_STACKSIZE to a sane value
Date: Tue, 11 Mar 2014 17:18:11 +0100	[thread overview]
Message-ID: <531F3743.3010206@citrix.com> (raw)
In-Reply-To: <1394553824.30915.78.camel@kazak.uk.xensource.com>

On 11/03/14 17:03, Ian Campbell wrote:
> On Tue, 2014-03-11 at 16:55 +0100, Roger Pau Monné wrote:
>>
>> Thanks, I've been able to get the stack pointer at each frame, here are
>> the results (from frame 0 to frame 10):
>>
>> 0x7fffffbfcff0
> 
> <-PAGE BOUNDARY HERE
> 
> Hence the segfault I expct...
> 
>> 0x7fffffbfd0a0
>> 0x7fffffbfd0e0
>> 0x7fffffbfd120
>> 0x7fffffbfd160
>> 0x7fffffbfd1a0
>> 0x7fffffbfd1e0
>> 0x7fffffbfd6a0
>> 0x7fffffbfd7a0
>> 0x7fffffbfd7c0
>> 0x7fffffbfd800
>>
>> Doing:
>>
>> 0x7fffffbfd800 - 0x7fffffbfcff0 = 0x810
>>
>> Which is 2064 in decimal. The biggest culprit seems to be malloc, which
>> is using 1216 bytes of the stack.
> 
> Wow!
> 
> http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdlib/malloc.c?rev=1.54.10.1&content-type=text/x-cvsweb-markup I suppose? malloc itself looks fairly small, but there's a lot of inlining in that function... I don't see any large on stack allocations (e.g. arrays) but I suppose it all adds up.

This is FreeBSD, which AFAIK is using jemalloc [0], the source inside of
the FreeBSD tree seems to be:

http://svnweb.freebsd.org/base/head/contrib/jemalloc/src/

And it looks like there's quite a lot of inlining there also...

Another question to ask would be why FreeBSD sets PTHREAD_STACK_MIN to
2048 when even a simple malloc call is going to blow that up, but I
guess you can run a thread with 2048 bytes of stack being really careful.

Roger.

[0] http://www.canonware.com/jemalloc/


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2014-03-11 16:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-07 12:22 [PATCH] xenstore: set READ_THREAD_STACKSIZE to a sane value Roger Pau Monne
2014-03-10 17:12 ` Ian Jackson
2014-03-11 13:24   ` Ian Campbell
2014-03-11 13:52     ` Roger Pau Monné
2014-03-11 14:12       ` Ian Campbell
2014-03-11 15:55         ` Roger Pau Monné
2014-03-11 16:03           ` Ian Campbell
2014-03-11 16:10             ` Ian Campbell
2014-03-11 16:18             ` Roger Pau Monné [this message]
2014-03-11 16:22               ` Ian Campbell
2014-03-11 16:25                 ` Ian Jackson
2014-03-11 16:32                   ` Ian Campbell
2014-03-11 16:42                   ` Roger Pau Monné
2014-03-11 16:52                     ` Ian Jackson
2014-03-12 10:27                       ` Roger Pau Monné
2014-03-12 10:30                         ` Ian Campbell
2014-03-12 10:34                           ` Roger Pau Monné
2014-03-18 17:16                           ` Ian Campbell
2014-03-18 17:20                             ` Ian Jackson
2014-03-21 12:18                               ` Ian Campbell

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=531F3743.3010206@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.