* The low resource handler now empties the cache depot's magazines; before,

they were never freed unless the cache was destroyed (I just wondered why
  my system would bury >1G in the magazines).
* Made the magazine capacity variable per cache, ie. for larger objects, it's
  not a good idea to have 64*CPU buffers lying around in the worst case.
* Furthermore, the create_object_cache_etc()/object_depot_init() now have
  arguments for the magazine capacity as well as the maximum number of full
  unused magazines.
* By default, you might want to initialize both to zero, as then some hopefully
  usable defaults are computed. Otherwise (the only current example is the
  vm_page_mapping cache) you can just put in the values you'd want there.
  The page mapping cache uses larger values, as its objects are usually
  allocated and deleted in larger chunks.
* Beware, though, I couldn't test these changes yet as Qemu didn't like to run
  today. I'll test these changes on another machine now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35601 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2010-02-24 14:43:20 +00:00
parent e7f640f25f
commit ff59ce680d
13 changed files with 112 additions and 59 deletions
+5 -5
View File
@@ -1329,7 +1329,7 @@ block_cache::Init()
mutex_init(&lock, "block cache");
buffer_cache = create_object_cache_etc("block cache buffers", block_size,
8, 0, CACHE_LARGE_SLAB, NULL, NULL, NULL, NULL);
8, 0, 0, 0, CACHE_LARGE_SLAB, NULL, NULL, NULL, NULL);
if (buffer_cache == NULL)
return B_NO_MEMORY;
@@ -1472,7 +1472,7 @@ block_cache::RemoveUnusedBlocks(int32 maxAccessed, int32 count)
if (block->is_dirty && !block->discard) {
if (block->busy_writing)
continue;
BlockWriter::WriteBlock(this, block);
}
@@ -2022,7 +2022,7 @@ dump_block(cached_block* block)
(addr_t)block, block->block_number,
(addr_t)block->current_data, (addr_t)block->original_data,
(addr_t)block->parent_data, block->ref_count, block->accessed,
block->busy_reading ? 'r' : '-', block->busy_writing ? 'w' : '-',
block->busy_reading ? 'r' : '-', block->busy_writing ? 'w' : '-',
block->is_writing ? 'W' : '-', block->is_dirty ? 'D' : '-',
block->unused ? 'U' : '-', block->discard ? 'D' : '-',
(addr_t)block->transaction,
@@ -2587,7 +2587,7 @@ status_t
block_cache_init(void)
{
sBlockCache = create_object_cache_etc("cached blocks", sizeof(cached_block),
8, 0, CACHE_LARGE_SLAB, NULL, NULL, NULL, NULL);
8, 0, 0, 0, CACHE_LARGE_SLAB, NULL, NULL, NULL, NULL);
if (sBlockCache == NULL)
return B_NO_MEMORY;
@@ -3299,7 +3299,7 @@ block_cache_sync(void* _cache)
}
hash_close(cache->hash, &iterator, false);
status_t status = writer.Write();
locker.Unlock();