[CP] Set up caching for large chunks of memory

This commit is contained in:
obdev
2023-06-02 02:49:03 +00:00
committed by ob-robot
parent 1c4a29ea94
commit a84b7a3e75
15 changed files with 472 additions and 104 deletions

View File

@ -180,13 +180,13 @@ TEST_F(TestAllocator, pm_basic)
// freelist
int large_size = INTACT_ACHUNK_SIZE - 200;
pm.set_max_chunk_cache_cnt(1);
pm.set_max_chunk_cache_size(INTACT_ACHUNK_SIZE);
ptr = pm.alloc_page(large_size);
hold = pm.get_hold();
ASSERT_GT(hold, 0);
pm.free_page(ptr);
ASSERT_EQ(pm.get_hold(), hold);
pm.set_max_chunk_cache_cnt(0);
pm.set_max_chunk_cache_size(0);
ptr = pm.alloc_page(large_size);
ASSERT_EQ(pm.get_hold(), hold);
pm.free_page(ptr);
@ -197,7 +197,7 @@ TEST_F(TestAllocator, pm_basic)
pm.free_page(ptr);
ASSERT_EQ(pm.get_hold(), hold);
pm.set_max_chunk_cache_cnt(2);
pm.set_max_chunk_cache_size(INTACT_ACHUNK_SIZE * 2);
pm.alloc_page(large_size);
pm.alloc_page(large_size);
pm.alloc_page(large_size);