Messages in this thread | | | Date | Tue, 28 Oct 2003 11:23:23 -0500 | From | Chris Friesen <> | Subject | Re: how do file-mapped (mmapped) pages become dirty? |
| |
Richard B. Johnson wrote: > On Tue, 28 Oct 2003, Chris Friesen wrote:
>>Note however that you need an msync() -- fsync() and fdatasync() do not >>catch changes to mmapped pages.
> Sure they do. fsync() will sync the whole file, regardless of > whether or not it's been mapped. msync() allows you to sync > only a specific portion and control how that portion is > handled with some flags.
According to Rik van Riel and HPA, fsync() does not check page tables for dirty bits. This is confirmed by my testing, in which msync() takes significantly longer than fsync() for the same file (in a ramdisk). msync() on the 3 pages dirtied took 39 usec, while fsync() on the whole 200KB file took 12 usec.
Also, some googling leads to to believe that if the file is mmapped and you close() it, it won't get synced.
Chris
-- Chris Friesen | MailStop: 043/33/F10 Nortel Networks | work: (613) 765-0557 3500 Carling Avenue | fax: (613) 765-2986 Nepean, ON K2H 8E9 Canada | email: cfriesen@nortelnetworks.com
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |