From 0a905b1db997b1f231d5d442e158b5228d69937a Mon Sep 17 00:00:00 2001 From: alc Date: Sat, 24 Apr 2010 17:32:52 +0000 Subject: Resurrect pmap_is_referenced() and use it in mincore(). Essentially, pmap_ts_referenced() is not always appropriate for checking whether or not pages have been referenced because it clears any reference bits that it encounters. For example, in mincore(), clearing the reference bits has two negative consequences. First, it throws off the activity count calculations performed by the page daemon. Specifically, a page on which mincore() has called pmap_ts_referenced() looks less active to the page daemon than it should. Consequently, the page could be deactivated prematurely by the page daemon. Arguably, this problem could be fixed by having mincore() duplicate the activity count calculation on the page. However, there is a second problem for which that is not a solution. In order to clear a reference on a 4KB page, it may be necessary to demote a 2/4MB page mapping. Thus, a mincore() by one process can have the side effect of demoting a superpage mapping within another process! --- sys/sun4v/sun4v/pmap.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sys/sun4v') diff --git a/sys/sun4v/sun4v/pmap.c b/sys/sun4v/sun4v/pmap.c index d3b8c79..2633b8e 100644 --- a/sys/sun4v/sun4v/pmap.c +++ b/sys/sun4v/sun4v/pmap.c @@ -1592,6 +1592,17 @@ pmap_is_prefaultable(pmap_t pmap, vm_offset_t va) } /* + * Return whether or not the specified physical page was referenced + * in any physical maps. + */ +boolean_t +pmap_is_referenced(vm_page_t m) +{ + + return (tte_get_phys_bit(m, VTD_REF)); +} + +/* * Extract the physical page address associated with the given kernel virtual * address. */ -- cgit v1.1