Merged branch haiku/branches/developer/bonefish/vm into trunk. This
introduces the following relevant changes:
* VMCache:
- Renamed vm_cache to VMCache, merged it with vm_store and made it a
C++ class with virtual methods (replacing the store operations).
Turned the different store implementations into subclasses.
- Introduced MergeStore() callback, changed semantics of Commit().
- Changed locking and referencing semantics. A reference can only be
acquired/released with the cache locked. An unreferenced cache is
deleted and a mergeable cache merged when it is unlocked. This
removes the "busy" state of a cache and simplifies the page fault
code.
* Added VMAnonymousCache, which will implement swap support (work by
Zhao Shuai). It is not integrated and used yet, though.
* Enabled the mutex/recursive lock holder asserts.
* Fixed DoublyLinkedList::Swap().
* Generalized the low memory handler to a low resource handler. And made
semaphores and reserved memory handled resources. Made
vm_try_resource_memory() optionally wait (with timeout), and used that
feature to reserve memory for areas.
...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26572 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -53,13 +53,13 @@ typedef struct rw_lock {
|
||||
#define RW_LOCK_FLAG_CLONE_NAME 0x1
|
||||
|
||||
|
||||
#if 0 && KDEBUG // XXX disable this for now, it causes problems when including thread.h here
|
||||
# include <thread.h>
|
||||
#define ASSERT_LOCKED_RECURSIVE(r) { ASSERT(thread_get_current_thread_id() == (r)->holder); }
|
||||
#define ASSERT_LOCKED_MUTEX(m) { ASSERT(thread_get_current_thread_id() == (m)->holder); }
|
||||
#if KDEBUG
|
||||
# define ASSERT_LOCKED_RECURSIVE(r) \
|
||||
{ ASSERT(find_thread(NULL) == (r)->lock.holder); }
|
||||
# define ASSERT_LOCKED_MUTEX(m) { ASSERT(find_thread(NULL) == (m)->holder); }
|
||||
#else
|
||||
#define ASSERT_LOCKED_RECURSIVE(r)
|
||||
#define ASSERT_LOCKED_MUTEX(m)
|
||||
# define ASSERT_LOCKED_RECURSIVE(r) do {} while (false)
|
||||
# define ASSERT_LOCKED_MUTEX(m) do {} while (false)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -102,10 +102,15 @@ extern void mutex_init(mutex* lock, const char* name);
|
||||
// name is *not* cloned nor freed in mutex_destroy()
|
||||
extern void mutex_init_etc(mutex* lock, const char* name, uint32 flags);
|
||||
extern void mutex_destroy(mutex* lock);
|
||||
extern status_t mutex_switch_lock(mutex* from, mutex* to);
|
||||
// Unlocks "from" and locks "to" such that unlocking and starting to wait
|
||||
// for the lock is atomically. I.e. if "from" guards the object "to" belongs
|
||||
// to, the operation is safe as long as "from" is held while destroying
|
||||
// "to".
|
||||
|
||||
// implementation private:
|
||||
extern status_t _mutex_lock(mutex* lock, bool threadsLocked);
|
||||
extern void _mutex_unlock(mutex* lock);
|
||||
extern void _mutex_unlock(mutex* lock, bool threadsLocked);
|
||||
extern status_t _mutex_trylock(mutex* lock);
|
||||
|
||||
|
||||
@@ -151,12 +156,10 @@ mutex_trylock(mutex* lock)
|
||||
static inline void
|
||||
mutex_unlock(mutex* lock)
|
||||
{
|
||||
#ifdef KDEBUG
|
||||
_mutex_unlock(lock);
|
||||
#else
|
||||
#if !defined(KDEBUG)
|
||||
if (atomic_add(&lock->count, 1) < -1)
|
||||
_mutex_unlock(lock);
|
||||
#endif
|
||||
_mutex_unlock(lock, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user