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
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to