On Friday, 30 January 1998 at 13:30:00 UTC+5:30, Stephen C. Tweedie wrote:
torv...@transmeta.com (Linus Torvalds) writes:
In article <m33ei8d...@bennevis.vmse.edo.dec.com>,
Stephen C. Tweedie <twe...@bennevis.vmse.edo.dec.com> wrote:
Yep, that will work, but it's not quite what I was trying to say --- basically, if you modify a MAP_SHARED page then there is no way that
you can make any guarantee that the data stays off disk. The initial
poster's remark was that:
With mmap() you have no control over the flushing behavior of the underlying fs. The OS may or may not write your buffers to disk, in
any order it chooses.
I am also in the same situation to avoid flushing the memory mapped region to disk for some time.
As per my analysis and some google search, kernel parameter "dirty_writeback_centisecs" is responsible for periodically calling the kernel threads that perform the flushing. By setting "dirty_writeback_centisecs" to '0' for some time and changing back to
default value, I was expecting that the flushing should not happen during the time when "dirty_writeback_centisecs" is'0'. But it is working partially i.e the flushing happens sometimes even though it's value is 0.
I also got to know that the flushing not only happens periodically but also happens whenever the number of dirty pages in memory exceeds a threshold value(and these threshold values are set by kernel parameters "dirty_background_ratio", "dirty_ratio")
In combination with "dirty_writeback_centisecs", I also tried increasing the values of kernel parameters "dirty_background_ratio", "dirty_ratio" to large values to increase the number of dirty pages that can be kept in memory before flushing to disk. I
also tried setting "dirty_expire_centisecs" to large value.
But this also works partially.
Note: I'm using device file "mtdblock0" for memory mapping into virtual address space if one of my process and I am assuming that mmap() syncing works for the device files in the same way as for regular files.
I'm also assuming that same set of threads that are responsible for flushing the page cache are also responsible for flushing the memory mapped region to the underlying file.
Please let me know if I'm missing something or my understanding of the flushing concepts is wrong. Please correct me if I'm wrong.
Thanks in Advance.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)