asmlinkage long sys_msync(unsigned long start, size_t len, int flags)

start and len select an area in the user address space of a process whose mapped data are to be synchronized with the underlying file.

datasync set and Inode in state l_DIRTY_DATASYNC?

The implementation of the system call is remarkably simple. As documented in the manual page msync(2), the system call essentially distinguishes two modes. If ms_sync is set in the flags, then dirty pages are written to disk synchronously, while ms_async is supposed to schedule dirty data for later writeback.

The good news is that for ms_async, no work at all is required! Since the kernel tracks the state of dirty pages, they will be synchronized at some point by the mechanisms described in this chapter anyway.

With ms_sync set, a little more work is necessary, and the code flow diagram in Figure 17-14 considers this case solely.

sys_msync find_vma

Iterate over all

Continue reading here: Summary

Was this article helpful?

0 0