1

I have an app that uses multiple memory mapped files. If I check the major page faults numbers (with /proc/<pid>/stat), they skyrocket.

I was wondering if it's possible to monitor somehow what memory mapped files are affected by the page swap ins and outs for a process?

At least I would like to see see what mmap-ed files are accessed for a process. I tried with strace, but I found no reads, because I guess no system calls are needed for the direct access to memory.

I would be happy also to know the virtual address in process space where they happen, so at least I could map them manually to the files in pmap output

1
perf trace -F maj

http://man7.org/linux/man-pages/man1/perf-trace.1.html

To connect to an existing process, use -p $PID. If you don't want to show system calls, pass --no-syscalls as well. The system call arguments won't be shown with the same level of detail as strace.

  • It seems we don't have perf trace, but we have perf record. It seems it's similar... – jack malkovick Jun 5 '18 at 11:02
  • with the peft record tool , I get this output while processing the log with perf script myprocess 28050 major-faults: 32301f2b () myprocess 28050 major-faults: 3239df34 () myprocess 28050 major-faults: 3239df34 () are the numbers in the last columns the info I'm looking for? – jack malkovick Jun 5 '18 at 11:26
  • @jackmalkovick hmm, I've seen this output before unix.stackexchange.com/questions/434171/… I'm not really sure what to guess about your output, except to say that I think the () part is normally supposed to show a filename. – sourcejedi Jun 5 '18 at 12:06
  • I'd wonder a bit whether you're using a JIT language like Java, then I'd guess that the file indications in perf script refer to the faulting instruction (when what you want is the address inside the page that is being faulted in), and in your case the instruction is in anonymous memory. – sourcejedi Jun 5 '18 at 12:08
  • Uh... yes. I'm using Java. I expected to see the virtual memory address where the page fault happen, not the address of the instruction that produced it. With the address I can match it to a file using pmap – jack malkovick Jun 5 '18 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.