I have a reader thread that mmap
s a files as read-only shared mapping. The other thread re-writes regions of that file on disk with write/fsync.
How exactly the changes propagate back to the mapping? My tests show major page faults in the reader and it's iowait jiffies clock up pretty fast. Measuring it exactly shows that 4-15 major faults a second may stall the tread anywhere from 0 to 500ms each second. I would like to understand at which point in writing thread corresponding pages of the reader get invalidated. Then, as per the tests, kernel updates invalidated pages on access from the reader (lazy model). Can it be changed to update-on-invalidation: somewhat similar to madvise
/willneed semantics but rolling while the mapping exists?