On Wed, Mar 31, 2021 at 07:06:26PM -0700, Dipen Patel wrote: > Hi, > > I was following > https://rt.wiki.kernel.org/index.php/Threaded_RT-application_with_memory_locking_and_stack_handling_example > with some below changes: > The example above is a bit inaccurate, as it prefaults the thread's stack much later than it should be. ... > > thread_fn { > getrusage(RUSAGE_SELF, &usage);> > print and save usage.ruminflt; > prove_thread_stack_use_is_safe > getrusage(RUSAGE_SELF, &usage); > print usage.ruminflt - last_saved_cnt; > } > > I observed there are still page faults. Well, in the snippet above, there will obviously be page faults, as you're also measuring the faults generated by prove_thread_stack_use_is_safe(). On first invocation, this is actually the method prefaulting the thread stack. To make sure the discussion is more concrete, can you please send a complete, compilable, *.c file? Good luck, -- Ahmed S. Darwish Linutronix GmbH