All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] avoiding page faults
@ 2011-04-13 15:59 Jeff Weber
  2011-04-14 12:18 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Weber @ 2011-04-13 15:59 UTC (permalink / raw)
  To: xenomai

[-- Attachment #1: Type: text/plain, Size: 870 bytes --]

I wish to avoid unwanted transitions of POSIX pthreads to secondary mode due
to page faults.

Does calling
mlockall(MCL_CURRENT | MCL_FUTURE)

lock pages when the memory is allocated, or referenced?

>From reviewing Xenomai, Linux RT_PREEMPT, and RTAI code, it appears the
answer is that memory is locked when the page is "referenced" (not
allocated), and that referencing by write is preferred over referencing by
read.  xeno_fault_stack() appears to pre-fault a subset of the stack when
turning the calling thread into a Xenomai thread.

If true, then I should allocate my own stack for each pthread created in my
program, and write every page ahead of time, then
call pthread_attr_setstack() prior to thread creation.  I should also write
every page of every dynamically allocated memory object.

Please help me verify if this understanding is correct.

thanks,
Jeff

[-- Attachment #2: Type: text/html, Size: 1077 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-14 15:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-13 15:59 [Xenomai-help] avoiding page faults Jeff Weber
2011-04-14 12:18 ` Gilles Chanteperdrix
2011-04-14 14:44   ` Jeff Weber
2011-04-14 15:03     ` Gilles Chanteperdrix

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.