MiReturnCommit

VOID __stdcall MiReturnCommit(_MI_PARTITION *Partition, UINT64 QuotaCharge){
  UINT64 v2; 
  struct _KPRCB *CurrentPrcb; 
  __int64 CachedCommit; 
  __int64 v6; 
  unsigned __int64 v7; 
  unsigned __int64 HighCommitThreshold; 
  unsigned __int64 LowCommitThreshold; 
  UINT64 v10; 
  _KLOCK_QUEUE_HANDLE LockHandle; 

  if( QuotaCharge )
  {
    v2 = QuotaCharge;
    memset(&LockHandle, 0, sizeof(LockHandle));
    if( !Partition->Commit.OverCommit
      || (KeAcquireInStackQueuedSpinLock(&Partition->Commit.EventLock, &LockHandle),
          LODWORD(v10) = MiRestockOverCommit((INT64)Partition, v2),
          v2 = v10,
          KeReleaseInStackQueuedSpinLockFromDpcLevel(&LockHandle),
          __writecr8(LockHandle.OldIrql),
          v2) )
    {
      if( Partition == &Irp
        && (CurrentPrcb = KeGetCurrentPrcb(),
            _m_prefetchw((const void *)&CurrentPrcb->CachedCommit),
            CachedCommit = CurrentPrcb->CachedCommit,
            v2 + CachedCommit <= 0x100) )
      {
        while( 1 )
        {
          v6 = _InterlockedCompareExchange(
                 (volatile signed __int32 *)&CurrentPrcb->CachedCommit,
                 CachedCommit + v2,
                 CachedCommit);
          if( v6 == CachedCommit )
            break;
          CachedCommit = v6;
          if( v6 + v2 > 0x100 )
            goto LABEL_7;
        }
      }
      else
      {
LABEL_7:
        v7 = _InterlockedExchangeAdd64((volatile signed __int64 *)&Partition->Vp.TotalCommittedPages, -(__int64)v2);
        HighCommitThreshold = Partition->Commit.HighCommitThreshold;
        if( v7 >= HighCommitThreshold && v7 - v2 < HighCommitThreshold
          || (LowCommitThreshold = Partition->Commit.LowCommitThreshold, v7 >= LowCommitThreshold)
          && v7 - v2 < LowCommitThreshold )
        {
          MiSyncCommitSignals(Partition, 0i64);
        }
      }
    }
  }
}

Referenced by:

MiAcquireNonPagedResources
MiAllocatePerSessionProtos
MiAttemptPageFileReductionApc
MiBuildForkPte
MiChargeForLockedPage
MiChargeSegmentCommit
MiCleanupPageTablePages
MiConvertPrivateToProto
MiConvertStandbyToProto
MiCopyOnWrite
MiCreateImageFileMap
MiCreateLargePfnList
MiCreatePagingFile
MiCreatePagingFileMap
MiCreateUltraThreadContextHelper
MiDecommitRegion
MiDecrementCloneBlockReference
MiDeleteBootRange
MiDeleteKernelStack
MiDeletePagingFiles
MiDeletePartialVad
MiDeletePerSessionProtos
MiDeleteSegmentPages
MiDeleteSessionPdes
MiDeleteSystemPageTableTail
MiDeleteUltraMapContext
MiDeleteVadBitmap
MiDereferenceSessionFinal
MiFindContiguousPages
MiFinishHardFault
MiFreeInitializationCode
MiFreePageFileHashPfns
MiFreePartitionPhysicalPages
MiGetCrossPartitionCombineCharges
MiGetFileHashPage
MiGetLargePagesForSystemMapping
MiGetPageTablePages
MiGetSubsectionCharges
MiHandleForkTransitionPte
MiIdealClusterPage
MiInsertInSystemSpace
MiInsertPartitionPages
MiMakePageAvoidRead
MiMakePartitionActive
MiMapPageFileHash
MiMarkBootGuardPage
MiMoveBadPageCrossPartition
MiObtainMdlCharges
MiObtainSystemCharges
MiPfPutPagesInTransition
MiPfnRangeIsZero
MiPrefetchReleasePreallocatedPages
MiProbeLockFrame
MiProcessVaContiguityInformation
MiRebuildLargePage
MiReferenceCloneProto
MiReleaseCommitForResetPages
MiReleaseNonPagedResources
MiReleaseOutSwappedProcessCommit
MiReleaseWriteInProgressCharges
MiRemoveLockedPageChargeAndDecRef
MiRemoveMappedPtes
MiRemovePhysicalMemory
MiRemoveVadCharges
MiResolveProtoPteFault
MiResolveTransitionFault
MiReturnCrossPartitionCombineCharges
MiReturnCrossPartitionSectionCharges
MiReturnExcessPoolCommit
MiReturnFaultCharges
MiReturnFullProcessCommitment
MiReturnPoolCharges
MiReturnSplitPageCharges
MiReturnSystemImageCommitment
MiSessionCreate
MiSessionCreateInternal
MiSessionInsertImage
MiSessionUpdateImageCharges
MiSetPagesModified
MiSetProtectionOnSection
MiTransferPartitionPageRun
MiUnlinkBadPages
MiUnlockImageSection
MiUnlockPageTableCharges
MiUnlockWsle
MmCheckCachedPageStates
MmCreateKernelStack
MmCreateProcessAddressSpace
MmDeleteProcessAddressSpace
MmFreePoolMemory
MmMarkPhysicalMemoryAsBad
MmReleaseResourceCharge
MmRotatePhysicalView
MmUnlockPages
NtLockVirtualMemory