[haiku-commits] r35735 - haiku/trunk/src/system/kernel/cache

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 3 Mar 2010 15:39:26 +0100 (CET)

Author: axeld
Date: 2010-03-03 15:39:26 +0100 (Wed, 03 Mar 2010)
New Revision: 35735
Changeset: http://dev.haiku-os.org/changeset/35735/haiku

Modified:
   haiku/trunk/src/system/kernel/cache/block_cache.cpp
Log:
* block_notifier_and_writer() will now flush 1000 blocks when reaching the soft
  memory limit.
* Improved debug output.


Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp
===================================================================
--- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2010-03-03 12:07:59 UTC 
(rev 35734)
+++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2010-03-03 14:39:26 UTC 
(rev 35735)
@@ -2022,6 +2022,9 @@
        kprintf(" current data:  %p\n", block->current_data);
        kprintf(" original data: %p\n", block->original_data);
        kprintf(" parent data:   %p\n", block->parent_data);
+#if BLOCK_CACHE_DEBUG_CHANGED
+       kprintf(" compare data:  %p\n", block->compare);
+#endif
        kprintf(" ref_count:     %ld\n", block->ref_count);
        kprintf(" accessed:      %ld\n", block->LastAccess());
        kprintf(" flags:        ");
@@ -2123,6 +2126,7 @@
        kprintf(" max_blocks:   %Ld\n", cache->max_blocks);
        kprintf(" block_size:   %lu\n", cache->block_size);
        kprintf(" next_transaction_id: %ld\n", cache->next_transaction_id);
+       kprintf(" buffer_cache: %p\n", cache->buffer_cache);
        kprintf(" busy_reading: %lu, %s waiters\n", cache->busy_reading_count,
                cache->busy_reading_waiters ? "has" : "no");
        kprintf(" busy_writing: %lu, %s waiters\n", cache->busy_writing_count,
@@ -2447,7 +2451,8 @@
                // write 64 blocks of each block_cache every two seconds
                // TODO: change this once we have an I/O scheduler
                timeout = kTimeout;
-               size_t usedMemory = 0;
+               size_t usedMemory;
+               object_cache_get_usage(sBlockCache, &usedMemory);
 
                block_cache* cache = NULL;
                while ((cache = get_next_locked_block_cache(cache)) != NULL) {
@@ -2503,7 +2508,7 @@
                                        > vm_page_num_pages() / 2) {
                                // Try to reduce memory usage to half of the 
available
                                // RAM at maximum
-                               cache->RemoveUnusedBlocks(500, 10);
+                               cache->RemoveUnusedBlocks(1000, 10);
                        }
                }
 


Other related posts:

  • » [haiku-commits] r35735 - haiku/trunk/src/system/kernel/cache - axeld