summaryrefslogtreecommitdiff
path: root/viengoos/pager.c
diff options
context:
space:
mode:
authorneal <neal>2008-06-23 19:53:37 +0000
committerneal <neal>2008-06-23 19:53:37 +0000
commitbc31075886288487b51b1a856f8718011a5d69e6 (patch)
tree91c673659f2c30369cbe59fff38da296803cc824 /viengoos/pager.c
parent486cab8528a7face71ee827157311272a563f9c5 (diff)
2008-06-23 Neal H. Walfield <neal@gnu.org>
* pager.h (pager_min_alloc_before_next_collect): New declaration. (pager_collect_needed): Only collect if AVAILABLE_PAGES > PAGER_LOW_WATER_MARK and PAGER_MIN_ALLOC_BEFORE_NEXT_COLLECT > 0. (pager_collect_needed): Don't include the dirty, non-discardable pages when consider if a collection is required. * pager.c (pager_min_alloc_before_next_collect): New variable. (pager_collect): If we don't collect enough pages to exceed the high water mark, set PAGER_MIN_ALLOC_BEFORE_NEXT_COLLECT to two-thirds the available pages. * memory.c (memory_frame_allocate): On success, decrement PAGER_MIN_ALLOC_BEFORE_NEXT_COLLECT.
Diffstat (limited to 'viengoos/pager.c')
-rw-r--r--viengoos/pager.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/viengoos/pager.c b/viengoos/pager.c
index 43c0c6d..d389c9b 100644
--- a/viengoos/pager.c
+++ b/viengoos/pager.c
@@ -24,11 +24,15 @@
#include "object.h"
#include "pager.h"
+int pager_min_alloc_before_next_collect;
+
static void
is_clean (struct object_desc *desc)
{
+#ifndef NDEBUG
struct object *object = object_desc_to_object (desc);
- l4_fpage_t result = l4_unmap_fpage (l4_fpage ((l4_word_t) object, PAGESIZE));
+ l4_fpage_t result = l4_unmap_fpage (l4_fpage ((l4_word_t) object,
+ PAGESIZE));
assertx (! l4_was_written (result) && ! l4_was_referenced (result),
"The %s " OID_FMT "(at %p) has status bits set (%s %s)",
cap_type_string (desc->type), OID_PRINTF (desc->oid), object,
@@ -52,6 +56,7 @@ is_clean (struct object_desc *desc)
cap_type_string (desc->type), OID_PRINTF (desc->oid),
object);
}
+#endif
}
/* Reclaim GOAL pages from VICTIM. (Reclaim means either schedule for
@@ -535,5 +540,14 @@ pager_collect (int goal)
total_freed += reclaim_from (victim, reclaim);
}
+ if (zalloc_memory + available_list_count (&available)
+ >= PAGER_HIGH_WATER_MARK)
+ /* We collected enough. */
+ pager_min_alloc_before_next_collect = 0;
+ else
+ /* Don't collect again until there have been at least 1/3 as many
+ allocations as there are currently remaining pages. */
+ pager_min_alloc_before_next_collect
+ = (zalloc_memory + available_list_count (&available)) / 3;
return total_freed;
}