* Added "caches" debugger command (to be enable by defining

DEBUG_CACHE_LIST) that prints an unspectacular list of pointers to all
  existing caches. Feel free to extend.
* Enhanced MultiAddressSpaceLocker:
  - It supports choosing between read and write lock per address space,
    now.
  - Added AddAreaCacheAndLock(), which adds the address spaces of all
    areas that are attached to a given area's cache, locks them, and
    locks the cache. It makes sure that the area list didn't change in
    the meantime and optionally also that all areas have their
    no_cache_change flags cleared.
* Changed vm_copy_on_write_area() to take a cache instead of an area,
  requiring it to be locked and all address spaces of affected areas to
  be read-locked, plus all areas' no_cache_change flags to be cleared.
  Callers simply use MultiAddressSpaceLocker:: AddAreaCacheAndLock() to
  do that. This resolves an open TODO, that the areas' base, size, and
  protection fields were accessed without their address spaces being
  locked.
* vm_copy_area() does now always insert a cache for the target area. Not
  doing that would cause source and target area being attached to
  the same cache in case the target protection was read-only. This
  would make them behave like cloned areas, which would lead to trouble
  when one of the areas would be changed to writable later.
* Fixed the !writable -> writable case in vm_set_area_protection(). It
  would simply change the protection of all mapped pages for this area,
  including ones from lower caches, thus causing later writes to the
  area to be seen by areas that shouldn't see them. This fixes a problem
  with software breakpoints in gdb. They could cause other programs to
  be dropped into the debugger.
* resize_area() uses MultiAddressSpaceLocker::AddAreaCacheAndLock() now,
  too, and could be compacted quite a bit.
 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22152 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2007-09-02 22:55:23 +00:00
parent addece2001
commit d2056c9933
4 changed files with 415 additions and 226 deletions
+17 -4
View File
@@ -25,6 +25,9 @@
// between caches.
//#define DEBUG_PAGE_CACHE_TRANSITIONS 1
// Enables a global list of all vm_cache structures.
//#define DEBUG_CACHE_LIST 1
#ifdef __cplusplus
struct vm_page_mapping;
typedef DoublyLinkedListLink<vm_page_mapping> vm_page_mapping_link;
@@ -91,14 +94,14 @@ typedef struct vm_page {
vm_page_mappings mappings;
#ifdef DEBUG_PAGE_QUEUE
#ifdef DEBUG_PAGE_QUEUE
void* queue;
#endif
#endif
#ifdef DEBUG_PAGE_CACHE_TRANSITIONS
#ifdef DEBUG_PAGE_CACHE_TRANSITIONS
uint32 debug_flags;
struct vm_page *collided_page;
#endif
#endif
uint8 type : 2;
uint8 state : 3;
@@ -162,8 +165,18 @@ typedef struct vm_cache {
uint32 scan_skip : 1;
uint32 busy : 1;
uint32 type : 5;
#if DEBUG_CACHE_LIST
struct vm_cache* debug_previous;
struct vm_cache* debug_next;
#endif
} vm_cache;
#if DEBUG_CACHE_LIST
extern vm_cache* gDebugCacheList;
#endif
// vm area
typedef struct vm_area {
char *name;