I am implementing the cp (file copy) command with mmap (). To do this, I compared the source file in MAP_PRIVATE mode (as I just want to read) and in the target file in MAP_SHARED mode (since I need to overwrite the modified contents of the target file).
At the same time, I observed a decrease in performance due to the large number of small page errors that occur due to 2 reasons. 1) Zero padding on demand when calling mmap (MAP_PRIVATE) for the source file. 2) Copy the record when calling mmap (MAP_SHARED) for the destination file.
Is there a way to disable Zero-fill-on-demand and Copy-on-write?
Thanks Harish
source
share