kernel/eka/memmodel/epoc/flexible/mmu/mmu.cpp
branchRCL_3
changeset 117 5b5d147c7838
parent 110 c734af59ce98
child 248 0ffb4e86fcc9
equal deleted inserted replaced
110:c734af59ce98 117:5b5d147c7838
   857 		__KTRACE_OPT(KMMU,Kern::Printf("Mmu::AllocRam returns simulated OOM %d",KErrNoMemory));
   857 		__KTRACE_OPT(KMMU,Kern::Printf("Mmu::AllocRam returns simulated OOM %d",KErrNoMemory));
   858 		return KErrNoMemory;
   858 		return KErrNoMemory;
   859 		}
   859 		}
   860 #endif
   860 #endif
   861 	TInt missing = iRamPageAllocator->AllocRamPages(aPages, aCount, aZonePageType, aBlockZoneId, aBlockRest);
   861 	TInt missing = iRamPageAllocator->AllocRamPages(aPages, aCount, aZonePageType, aBlockZoneId, aBlockRest);
   862 	if(missing && !(aFlags&EAllocNoPagerReclaim) && ThePager.GetFreePages(missing))
   862 	if(missing && !(aFlags&EAllocNoPagerReclaim))
   863 		missing = iRamPageAllocator->AllocRamPages(aPages, aCount, aZonePageType, aBlockZoneId, aBlockRest);
   863 		{
       
   864 		// taking the page cleaning lock here prevents the pager releasing the ram alloc lock
       
   865 		PageCleaningLock::Lock();  
       
   866 		if (ThePager.GetFreePages(missing))
       
   867 			missing = iRamPageAllocator->AllocRamPages(aPages, aCount, aZonePageType, aBlockZoneId, aBlockRest);
       
   868 		PageCleaningLock::Unlock();  
       
   869 		}
   864 	TInt r = missing ? KErrNoMemory : KErrNone;
   870 	TInt r = missing ? KErrNoMemory : KErrNone;
   865 	if(r!=KErrNone)
   871 	if(r!=KErrNone)
   866 		iRamAllocFailed = ETrue;
   872 		iRamAllocFailed = ETrue;
   867 	else
   873 	else
   868 		PagesAllocated(aPages,aCount,aFlags);
   874 		PagesAllocated(aPages,aCount,aFlags);