Re: [PATCH -v5 2/2] Updating ctime and mtime at syncing

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <salikhmetov@...>
Cc: <miklos@...>, <linux-mm@...>, <jakob@...>, <linux-kernel@...>, <valdis.kletnieks@...>, <riel@...>, <ksm@...>, <staubach@...>, <jesper.juhl@...>, <torvalds@...>, <a.p.zijlstra@...>, <akpm@...>, <protasnb@...>, <r.e.wolff@...>, <hidave.darkstar@...>, <hch@...>
Date: Thursday, January 17, 2008 - 11:45 am

> > I'm not sure this auto-updating is really needed (POSIX doesn't

Can they state their reasons for the insistence?


Oh, and the four-liner I posted the other day will give you 1) + 2) +
even more at a small fraction of the complexity.  And tacking on the
reprotect code will solve the MS_ASYNC issue just the same.

I agree, that having the timestamp updated on sync() is nice, and that
trivial patch will give you that, and will also update the timestamp
at least each 30 seconds if the file is being constantly modified,
even if no explicit syncing is done.

So maybe it's worth a little effort benchmarking how much that patch
affects the cost of writing to a page.

You could write a little test program like this (if somebody hasn't
yet done so):

 - do some preparation:

   echo 80 > dirty_ratio
   echo 80 > dirty_background_ratio
   echo 30000 > dirty_expire_centisecs
   sync

 - map a large file, one that fits comfortably into free memory
 - bring the whole file in, by reading a byte from each page
 - start the timer
 - write a byte to each page
 - stop the timer

It would be most interesting to try this on a filesystem supporting
nanosecond timestamps.  Anyone know which these are?

Miklos
----

Index: linux/mm/memory.c
===================================================================
--- linux.orig/mm/memory.c	2008-01-09 21:16:30.000000000 +0100
+++ linux/mm/memory.c	2008-01-15 21:16:14.000000000 +0100
@@ -1680,6 +1680,8 @@ gotten:
 unlock:
 	pte_unmap_unlock(page_table, ptl);
 	if (dirty_page) {
+		if (vma->vm_file)
+			file_update_time(vma->vm_file);
 		/*
 		 * Yes, Virginia, this is actually required to prevent a race
 		 * with clear_page_dirty_for_io() from clearing the page dirty
@@ -2313,6 +2315,8 @@ out_unlocked:
 	if (anon)
 		page_cache_release(vmf.page);
 	else if (dirty_page) {
+		if (vma->vm_file)
+			file_update_time(vma->vm_file);
 		set_page_dirty_balance(dirty_page, page_mkwrite);
 		put_page(dirty_page);
 	}


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH -v5 0/2] Updating ctime and mtime for memory-mapped f..., Anton Salikhmetov, (Wed Jan 16, 8:57 pm)
[PATCH -v5 2/2] Updating ctime and mtime at syncing, Anton Salikhmetov, (Wed Jan 16, 8:57 pm)
Re: [PATCH -v5 2/2] Updating ctime and mtime at syncing, Miklos Szeredi, (Thu Jan 17, 7:13 am)
Re: [PATCH -v5 2/2] Updating ctime and mtime at syncing, Anton Salikhmetov, (Thu Jan 17, 8:16 am)
Re: [PATCH -v5 2/2] Updating ctime and mtime at syncing, Miklos Szeredi, (Thu Jan 17, 8:45 am)
Re: [PATCH -v5 2/2] Updating ctime and mtime at syncing, Anton Salikhmetov, (Thu Jan 17, 9:16 am)
Re: [PATCH -v5 2/2] Updating ctime and mtime at syncing, Miklos Szeredi, (Thu Jan 17, 9:33 am)
Re: [PATCH -v5 2/2] Updating ctime and mtime at syncing, Anton Salikhmetov, (Thu Jan 17, 9:40 am)
Re: [PATCH -v5 2/2] Updating ctime and mtime at syncing, Miklos Szeredi, (Thu Jan 17, 11:45 am)
Re: [PATCH -v5 2/2] Updating ctime and mtime at syncing, Anton Salikhmetov, (Thu Jan 17, 12:20 pm)
Re: [PATCH -v5 2/2] Updating ctime and mtime at syncing, Miklos Szeredi, (Thu Jan 17, 12:26 pm)
Re: [PATCH -v5 2/2] Updating ctime and mtime at syncing, Anton Salikhmetov, (Thu Jan 17, 12:33 pm)
Re: [PATCH -v5 2/2] Updating ctime and mtime at syncing, Rogier Wolff, (Thu Jan 17, 9:24 am)
Re: [PATCH -v5 2/2] Updating ctime and mtime at syncing, Anton Salikhmetov, (Thu Jan 17, 9:34 am)
Re: [PATCH -v5 2/2] Updating ctime and mtime at syncing, Rogier Wolff, (Thu Jan 17, 8:51 am)
[PATCH -v5 1/2] Massive code cleanup of sys_msync(), Anton Salikhmetov, (Wed Jan 16, 8:57 pm)
Re: [PATCH -v5 1/2] Massive code cleanup of sys_msync(), Miklos Szeredi, (Thu Jan 17, 7:01 am)
Re: [PATCH -v5 1/2] Massive code cleanup of sys_msync(), Anton Salikhmetov, (Thu Jan 17, 7:47 am)