linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Cc: "linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>
Subject: Re: Minor page faults from pthread_create()
Date: Mon, 9 Jan 2012 17:00:52 -0200	[thread overview]
Message-ID: <20120109190052.GD32530@infradead.org> (raw)
In-Reply-To: <4F075DA5.1070307@drcomp.erfurt.thur.de>

Em Fri, Jan 06, 2012 at 09:46:29PM +0100, Adrian Knoth escreveu:
> While playing with
> 
> https://rt.wiki.kernel.org/articles/t/h/r/Threaded_RT-application_with_memory_locking_and_stack_handling_example_f48b.html
> 
> I was wondering why pthread_create() should cause minor page faults when
> there is a pre-allocated pre-faulted 100MB memory pool.
> 
> Simply running the example causes roughly 30 minor page faults. When I
> manually allocate stack memory for the stack (after mlockall() and
> mallopt have been called) and use pthread_attr_setstack() before calling
> pthread_create(), minor page faults drop to 2.
> 
> Does anybody happen to know what is causing these remaining two page
> faults? My only guess so far is kernel memory to hold some
> organizational data for the new thread after clone() has been invoked,
> but this could also be completely wrong.
> 
> Note that I don't need to get page faults down to 0, I'm only looking
> for an explanation to understand the issue at hand to confirm that
> pthread_create() must not be used from an RT context.

Try:

$ perf record --event minor-faults --call-graph your-program
$ perf report

Should answer that question if running on a -fno-omit-frame-pointer
binary world. Or at least provide the callchains for the kernel part of
the call chains.

32-bit distros should be OK in that respect.

- Arnaldo

      parent reply	other threads:[~2012-01-09 19:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-06 20:46 Minor page faults from pthread_create() Adrian Knoth
2012-01-07 18:28 ` Remy Bohmer
2012-01-09 10:35 ` Minor page faults from pthread_create() aka still problems with 3.0.12-rt30 Tim Sander
2012-01-09 19:00 ` Arnaldo Carvalho de Melo [this message]

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=20120109190052.GD32530@infradead.org \
    --to=acme@infradead.org \
    --cc=adi@drcomp.erfurt.thur.de \
    --cc=linux-rt-users@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).