Re: [PATCH] mm/filemap.c: unconditionally call mark_page_accessed

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andreas Mohr
Date: Wednesday, March 14, 2007 - 2:33 pm

Hi,

On Wed, Mar 14, 2007 at 03:55:41PM -0500, Dave Kleikamp wrote:

I also think that the patch is somewhat problematic, since the original
intention seems to have been a reduction of the number of (expensive?)
mark_page_accessed() calls, but this of course falls flat on its face in case
of permanent single-page accesses or accesses with progressing but very small
read size (single-byte reads or so), since the cached page content will expire
eventually due to lack of mark_page_accessed() updates; thus this patch
decided to call mark_page_accessed() unconditionally which may be a large
performance penalty for subsequent tiny-sized reads.

I've been thinking hard how to avoid the mark_page_accessed() starvation in
case of a fixed, (almost) non-changing access state, but this seems hard since
it'd seem we need some kind of state management here to figure out good
intervals of when to call mark_page_accessed() *again* for this page. E.g.
despite non-changing access patterns you could still call mark_page_accessed()
every 32 calls or so to avoid expiry, but this would need extra helper
variables.

A rather ugly way to do it may be to abuse ra.cache_hit or ra.mmap_hit content
with a
	if ((prev_index != index) || (ra.cache_hit % 32 == 0))
		mark_page_accessed(page);
This assumes that ra.cache_hit gets incremented for every access (haven't
checked whether this is the case).
That way (combined with an enhanced comment properly explaining the dilemma)
you would avoid most mark_page_accessed() invocations of subsequent same-page reads
but still do page status updates from time to time to avoid page deprecation.

Does anyone think this would be acceptable? Any better idea?

Andreas Mohr

P.S.: since I'm not too familiar with this area I could be rather wrong after all...
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
do_generic_mapping_read performance issue, Ashif Harji, (Fri Mar 9, 3:03 pm)
Re: do_generic_mapping_read performance issue, Jan Kara, (Mon Mar 12, 7:20 am)
Re: do_generic_mapping_read performance issue, Nick Piggin, (Mon Mar 12, 7:39 am)
Re: do_generic_mapping_read performance issue, Jan Kara, (Mon Mar 12, 8:13 am)
Re: do_generic_mapping_read performance issue, Ashif Harji, (Mon Mar 12, 9:46 am)
Re: do_generic_mapping_read performance issue, Ashif Harji, (Mon Mar 12, 10:05 am)
Re: do_generic_mapping_read performance issue, Jan Kara, (Mon Mar 12, 10:35 am)
Re: do_generic_mapping_read performance issue, Ashif Harji, (Tue Mar 13, 11:43 am)
Re: do_generic_mapping_read performance issue, Jan Kara, (Tue Mar 13, 11:55 am)
Re: [PATCH] mm/filemap.c: unconditionally call mark_page_a ..., Andreas Mohr, (Wed Mar 14, 2:33 pm)
Re: [PATCH] mm/filemap.c: unconditionally call mark_page_a ..., Valdis.Kletnieks, (Thu Mar 15, 10:37 am)