vm_page no longer points directly to its containing cache, but rather to a
VMCacheRef object which points to the cache. This allows to optimize VMCache::MoveAllPages(), since it no longer needs to iterate over all pages to adjust their cache pointer. It can simple swap the cache refs of the two caches instead. Reduces the total -j8 Haiku image build time only marginally. The kernel time drops almost 10%, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35155 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -61,6 +61,7 @@ struct VMCachePagesTreeDefinition {
|
||||
|
||||
typedef IteratableSplayTree<VMCachePagesTreeDefinition> VMCachePagesTree;
|
||||
|
||||
|
||||
struct VMCache {
|
||||
public:
|
||||
VMCache();
|
||||
@@ -171,6 +172,7 @@ public:
|
||||
|
||||
private:
|
||||
struct PageEventWaiter;
|
||||
friend struct VMCacheRef;
|
||||
|
||||
private:
|
||||
void _NotifyPageEvents(vm_page* page, uint32 events);
|
||||
@@ -185,6 +187,7 @@ private:
|
||||
mutex fLock;
|
||||
PageEventWaiter* fPageEventWaiters;
|
||||
void* fUserData;
|
||||
VMCacheRef* fCacheRef;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
class AsyncIOCallback;
|
||||
struct vm_page_mapping;
|
||||
struct VMCache;
|
||||
struct VMCacheRef;
|
||||
typedef DoublyLinkedListLink<vm_page_mapping> vm_page_mapping_link;
|
||||
|
||||
|
||||
@@ -71,12 +72,23 @@ typedef class DoublyLinkedQueue<vm_page_mapping, DoublyLinkedAreaLink>
|
||||
|
||||
typedef uint32 page_num_t;
|
||||
|
||||
|
||||
struct VMCacheRef {
|
||||
VMCache* cache;
|
||||
int32 ref_count;
|
||||
|
||||
VMCacheRef(VMCache* cache);
|
||||
};
|
||||
|
||||
|
||||
struct vm_page {
|
||||
DoublyLinkedListLink<vm_page> queue_link;
|
||||
|
||||
addr_t physical_page_number;
|
||||
|
||||
VMCache* cache;
|
||||
private:
|
||||
VMCacheRef* cache_ref;
|
||||
public:
|
||||
page_num_t cache_offset;
|
||||
// in page size units
|
||||
|
||||
@@ -103,6 +115,13 @@ struct vm_page {
|
||||
|
||||
int8 usage_count;
|
||||
uint16 wired_count;
|
||||
|
||||
|
||||
VMCacheRef* CacheRef() const { return cache_ref; }
|
||||
void SetCacheRef(VMCacheRef* cacheRef) { this->cache_ref = cacheRef; }
|
||||
|
||||
VMCache* Cache() const
|
||||
{ return cache_ref != NULL ? cache_ref->cache : NULL; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user