added CACHE_UNLOCKED_PAGES flag to allow caches' pages to be created with no locking instead of full locking.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20911 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Hugo Santos
2007-04-29 20:55:44 +00:00
parent 6b783773bf
commit 11debaf6e4
2 changed files with 6 additions and 1 deletions
+1
View File
@@ -18,6 +18,7 @@ extern "C" {
enum {
/* create_object_cache_etc flags */
CACHE_NO_DEPOT = 1 << 0,
CACHE_UNLOCKED_PAGES = 1 << 1,
/* object_cache_alloc flags */
CACHE_DONT_SLEEP = 1 << 8,
+5 -1
View File
@@ -260,11 +260,15 @@ allocate_pages(object_cache *cache, void **pages, uint32 flags)
{
TRACE_CACHE(cache, "allocate pages (%lu, 0x0%lx)", cache->slab_size, flags);
uint32 lock = B_FULL_LOCK;
if (cache->flags & CACHE_UNLOCKED_PAGES)
lock = B_NO_LOCK;
// if we are allocating, it is because we need the pages immediatly
// so we lock them. when moving the slab to the empty list we should
// unlock them, and lock them again when getting one from the empty list.
area_id areaId = create_area(cache->name, pages, B_ANY_KERNEL_ADDRESS,
cache->slab_size, B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
cache->slab_size, lock, B_READ_AREA | B_WRITE_AREA);
if (areaId < 0)
return areaId;