kernel/vm: Add "unmergeable" flag to VMCache.
ramfs needs to create caches that are both temporary and unmergeable, so add another flag to make this state possible. Otherwise, mmap'ed files from ramfs might wind up in VMCache trying to merge the caches when the last one is closed, which we don't want.
This commit is contained in:
@@ -198,6 +198,7 @@ public:
|
|||||||
// TODO: Remove!
|
// TODO: Remove!
|
||||||
uint32 page_count;
|
uint32 page_count;
|
||||||
uint32 temporary : 1;
|
uint32 temporary : 1;
|
||||||
|
uint32 unmergeable : 1;
|
||||||
uint32 type : 6;
|
uint32 type : 6;
|
||||||
|
|
||||||
#if DEBUG_CACHE_LIST
|
#if DEBUG_CACHE_LIST
|
||||||
|
|||||||
@@ -255,6 +255,7 @@ DataContainer::_SwitchToCacheMode()
|
|||||||
return error;
|
return error;
|
||||||
|
|
||||||
fCache->temporary = 1;
|
fCache->temporary = 1;
|
||||||
|
fCache->unmergeable = 1;
|
||||||
fCache->virtual_end = fSize;
|
fCache->virtual_end = fSize;
|
||||||
|
|
||||||
error = fCache->Commit(fSize, VM_PRIORITY_USER);
|
error = fCache->Commit(fSize, VM_PRIORITY_USER);
|
||||||
|
|||||||
@@ -627,8 +627,8 @@ VMCacheRef::VMCacheRef(VMCache* cache)
|
|||||||
bool
|
bool
|
||||||
VMCache::_IsMergeable() const
|
VMCache::_IsMergeable() const
|
||||||
{
|
{
|
||||||
return areas == NULL && temporary && !consumers.IsEmpty()
|
return areas == NULL && temporary && !unmergeable
|
||||||
&& consumers.Head() == consumers.Tail();
|
&& !consumers.IsEmpty() && consumers.Head() == consumers.Tail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -657,6 +657,7 @@ VMCache::Init(uint32 cacheType, uint32 allocationFlags)
|
|||||||
virtual_end = 0;
|
virtual_end = 0;
|
||||||
committed_size = 0;
|
committed_size = 0;
|
||||||
temporary = 0;
|
temporary = 0;
|
||||||
|
unmergeable = 0;
|
||||||
page_count = 0;
|
page_count = 0;
|
||||||
fWiredPagesCount = 0;
|
fWiredPagesCount = 0;
|
||||||
type = cacheType;
|
type = cacheType;
|
||||||
|
|||||||
Reference in New Issue
Block a user