olafbuddenha...@gmx.net, le Mon 05 Sep 2011 06:42:22 +0200, a écrit :
> On Mon, Jul 25, 2011 at 10:32:03AM +0200, Thomas Schwinge wrote:
> 
> > Building a certain GCC configuration on a freshly booted system: 11 h.
> > Remove build tree, build it again (2nd): 12 h 50 min.  Huh.  Remove
> > build tree, reboot, build it again (1st): back to 11 h.  Remove build
> > tree, build it again (2nd): 12 h 40 min.  Remove build tree, build it
> > again (3rd): 15 h.
> 
> I first observed this a long time ago: opening my large NFS-mounted
> mailbox is considerably quicker after a fresh boot than after running
> for a while.

Note the issue

https://savannah.gnu.org/bugs/?28730

I've just attached an experimental patch I haven't had the time to
experiment more with.

Samuel
diff --git a/vm/vm_object.c b/vm/vm_object.c
index 9057973..6d12d4b 100644
--- a/vm/vm_object.c
+++ b/vm/vm_object.c
@@ -349,6 +349,46 @@ void vm_object_reference(
 }
 
 /*
+ *     vm_object_collect:
+ *
+ *     Called by the pageout daemon when the system needs more free pages.
+ */
+void vm_object_collect(void)
+{
+       vm_object_t object, next, temp;
+
+       vm_object_cache_lock();
+       object = (vm_object_t) queue_first(&vm_object_cached_list);
+
+       while (!queue_end(&vm_object_cached_list, (queue_entry_t) object)) {
+               next = (vm_object_t) queue_next(&object->cached_list);
+
+               if (object->resident_page_count == 0) {
+                       vm_object_lock(object);
+                       if ((object->pager_created &&
+                           !object->pager_initialized)) {
+                               /* Not ready, look at it later */
+                               vm_object_unlock(object);
+                               continue;
+                       }
+                       queue_remove(&vm_object_cached_list, object,
+                                       vm_object_t, cached_list);
+                       vm_object_cached_count--;
+
+                       assert(object->ref_count == 0);
+
+                       temp = object->shadow;
+                       vm_object_terminate(object);
+                       if (temp) {
+                               vm_object_deallocate(temp);
+                       }
+               }
+               object = next;
+       }
+       vm_object_cache_unlock();
+}
+
+/*
  *     vm_object_deallocate:
  *
  *     Release a reference to the specified object,
@@ -407,6 +447,7 @@ void vm_object_deallocate(
                        queue_enter(&vm_object_cached_list, object,
                                vm_object_t, cached_list);
                        overflow = (++vm_object_cached_count > 
vm_object_cached_max);
+                       overflow = 0;
                        vm_object_cache_unlock();
 
                        vm_object_deactivate_pages(object);
diff --git a/vm/vm_object.h b/vm/vm_object.h
index c992570..6fd1852 100644
--- a/vm/vm_object.h
+++ b/vm/vm_object.h
@@ -172,6 +172,7 @@ extern void         vm_object_init(void);
 extern void            vm_object_terminate(vm_object_t);
 extern vm_object_t     vm_object_allocate(vm_size_t);
 extern void            vm_object_reference(vm_object_t);
+extern void            vm_object_collect(void);
 extern void            vm_object_deallocate(vm_object_t);
 extern void            vm_object_pmap_protect(
        vm_object_t     object,
diff --git a/vm/vm_pageout.c b/vm/vm_pageout.c
index 7a755bf..1f18644 100644
--- a/vm/vm_pageout.c
+++ b/vm/vm_pageout.c
@@ -556,6 +556,7 @@ void vm_pageout_scan()
        consider_task_collect();
        consider_thread_collect();
        consider_zone_gc();
+       vm_object_collect();
 
        for (burst_count = 0;;) {
                register vm_page_t m;

Reply via email to