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:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user