mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[NTOSKRNL] Use interlocked operations when dealing with map count.
CORE-14349
This commit is contained in:
parent
1b672981e2
commit
40017a54f9
1 changed files with 7 additions and 10 deletions
|
@ -344,7 +344,7 @@ retry:
|
|||
CcRosVacbIncRefCount(current);
|
||||
|
||||
/* Check if it's mapped and not dirty */
|
||||
if (current->MappedCount > 0 && !current->Dirty)
|
||||
if (InterlockedCompareExchange((PLONG)¤t->MappedCount, 0, 0) > 0 && !current->Dirty)
|
||||
{
|
||||
/* We have to break these locks because Cc sucks */
|
||||
KeReleaseSpinLock(¤t->SharedCacheMap->CacheMapLock, oldIrql);
|
||||
|
@ -448,14 +448,13 @@ CcRosReleaseVacb (
|
|||
|
||||
if (Mapped)
|
||||
{
|
||||
Vacb->MappedCount++;
|
||||
}
|
||||
Refs = CcRosVacbDecRefCount(Vacb);
|
||||
if (Mapped && (Vacb->MappedCount == 1))
|
||||
{
|
||||
CcRosVacbIncRefCount(Vacb);
|
||||
if (InterlockedIncrement((PLONG)&Vacb->MappedCount) == 1)
|
||||
{
|
||||
CcRosVacbIncRefCount(Vacb);
|
||||
}
|
||||
}
|
||||
|
||||
Refs = CcRosVacbDecRefCount(Vacb);
|
||||
ASSERT(Refs > 0);
|
||||
|
||||
CcRosReleaseVacbLock(Vacb);
|
||||
|
@ -630,9 +629,7 @@ CcRosUnmapVacb (
|
|||
}
|
||||
|
||||
ASSERT(Vacb->MappedCount != 0);
|
||||
Vacb->MappedCount--;
|
||||
|
||||
if (Vacb->MappedCount == 0)
|
||||
if (InterlockedDecrement((PLONG)&Vacb->MappedCount) == 0)
|
||||
{
|
||||
CcRosVacbDecRefCount(Vacb);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue