* Minor page faults from pthread_create()
@ 2012-01-06 20:46 Adrian Knoth
2012-01-07 18:28 ` Remy Bohmer
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Adrian Knoth @ 2012-01-06 20:46 UTC (permalink / raw)
To: linux-rt-users@vger.kernel.org
Hi!
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.
TIA
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Minor page faults from pthread_create()
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 ` Minor page faults from pthread_create() Arnaldo Carvalho de Melo
2 siblings, 0 replies; 4+ messages in thread
From: Remy Bohmer @ 2012-01-07 18:28 UTC (permalink / raw)
To: Adrian Knoth; +Cc: linux-rt-users@vger.kernel.org
Hi,
2012/1/6 Adrian Knoth <adi@drcomp.erfurt.thur.de>:
> I was wondering why pthread_create() should cause minor page faults when
> there is a pre-allocated pre-faulted 100MB memory pool.
That pre-allocated block of memory is used by Glibc for its malloc routines.
While doing a pthread_create() you go to the kernel. Inside the kernel
many functions allocate memory as well. This is outside the control of
the C-library.
Probably some function inside the kernel allocates this memory and
uses it, resulting in these page-faults.
One example is allocating memory for the stack.
Kind regards,
Remy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Minor page faults from pthread_create() aka still problems with 3.0.12-rt30
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 ` Tim Sander
2012-01-09 19:00 ` Minor page faults from pthread_create() Arnaldo Carvalho de Melo
2 siblings, 0 replies; 4+ messages in thread
From: Tim Sander @ 2012-01-09 10:35 UTC (permalink / raw)
To: Adrian Knoth; +Cc: linux-rt-users
Hi
> 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.
While unfortunatly i can't help i've got the impression that something is
still strange with 3.0.12pmx-rt30. (This is on a arm i.mx35 with some
platform adaptations and a cyclic clock interrupt.). I haven't build a newer
version of 3.0-rt yet.
See my mail where i describe this problem here.
https://lkml.org/lkml/2011/12/7/657
I am ocasionally also seeing a ksoftirqd/0 running on as much cpu as it gets.
This is always when i see the message: sched: RT throttling activated
Not the best start into the new year :-(.
Best regards
Tim
Please ignore:
Hottinger Baldwin Messtechnik GmbH, Im Tiefen See 45, 64293 Darmstadt, Germany | www.hbm.com
Registered as GmbH (German limited liability corporation) in the commercial register at the local court of Darmstadt, HRB 1147
Company domiciled in Darmstadt | CEO: Andreas Huellhorst | Chairman of the board: James Charles Webster
Als Gesellschaft mit beschraenkter Haftung eingetragen im Handelsregister des Amtsgerichts Darmstadt unter HRB 1147
Sitz der Gesellschaft: Darmstadt | Geschaeftsfuehrung: Andreas Huellhorst | Aufsichtsratsvorsitzender: James Charles Webster
The information in this email is confidential. It is intended solely for the addressee. If you are not the intended recipient, please let me know and delete this email.
Die in dieser E-Mail enthaltene Information ist vertraulich und lediglich für den Empfaenger bestimmt. Sollten Sie nicht der eigentliche Empfaenger sein, informieren Sie mich bitte kurz und loeschen diese E-Mail.
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Minor page faults from pthread_create()
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
2 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-01-09 19:00 UTC (permalink / raw)
To: Adrian Knoth; +Cc: linux-rt-users@vger.kernel.org
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-01-09 19:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` Minor page faults from pthread_create() Arnaldo Carvalho de Melo
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).