kernel/eka/memmodel/epoc/flexible/mmu/mdefrag.cpp
branchRCL_3
changeset 41 0ffb4e86fcc9
parent 28 5b5d147c7838
equal deleted inserted replaced
39:2bb754abd467 41:0ffb4e86fcc9
   139 			}
   139 			}
   140 		switch (pi->Type())
   140 		switch (pi->Type())
   141 			{
   141 			{
   142 			case SPageInfo::EManaged:
   142 			case SPageInfo::EManaged:
   143 				memory = pi->Owner();
   143 				memory = pi->Owner();
   144 				// Note, whilst we hold the RamAllocLock the page can't change it's use
   144 				memory->Open();
   145 				// and we can safely assume that it still belongs to the memory object
   145 				// move page, this will release the mmu lock.
   146 				// at a fixed page index.
       
   147 				// Also, as memory objects can't be destroyed whilst they still own pages
       
   148 				// we can safely access this object without taking an explicit reference,
       
   149 				// i.e. we don't need to Open() the memory object.
       
   150 				MmuLock::Unlock();
       
   151 				// move page...
       
   152 				r = memory->iManager->MovePage(	memory, pi, aNew, aBlockZoneId, 
   146 				r = memory->iManager->MovePage(	memory, pi, aNew, aBlockZoneId, 
   153 												(aMoveDisFlags & M::EMoveDisBlockRest)!=0);
   147 												(aMoveDisFlags & M::EMoveDisBlockRest)!=0);
       
   148 				memory->AsyncClose();
   154 				break;
   149 				break;
   155 			case SPageInfo::EUnused:
   150 			case SPageInfo::EUnused:
   156 				r = KErrNotFound;	// This page is free so nothing to do.
   151 				r = KErrNotFound;	// This page is free so nothing to do.
   157 				// Fall through..
   152 				// Fall through..
   158 			default:
   153 			default:
   185 			}
   180 			}
   186 		switch (pi->Type())
   181 		switch (pi->Type())
   187 			{
   182 			{
   188 			case SPageInfo::EManaged:
   183 			case SPageInfo::EManaged:
   189 				memory = pi->Owner();
   184 				memory = pi->Owner();
   190 				// Note, whilst we hold the RamAllocLock the page can't change it's use
   185 				memory->Open();
   191 				// and we can safely assume that it still belongs to the memory object
   186 				// move page, this will release the mmu lock.
   192 				// at a fixed page index.
       
   193 				// Also, as memory objects can't be destroyed whilst they still own pages
       
   194 				// we can safely access this object without taking an explicit referernce,
       
   195 				// i.e. we don't need to Open() the memory object.
       
   196 				MmuLock::Unlock();
       
   197 				// move page...
       
   198 				r = memory->iManager->MoveAndAllocPage(memory, pi, aPageType);
   187 				r = memory->iManager->MoveAndAllocPage(memory, pi, aPageType);
       
   188 				memory->AsyncClose();
   199 				break;
   189 				break;
   200 			case SPageInfo::EUnused:
   190 			case SPageInfo::EUnused:
   201 				r = KErrNone;	// This page is free so nothing to do.
   191 				r = KErrNone;	// This page is free so nothing to do.
   202 				// Fall through..
   192 				// Fall through..
   203 			default:
   193 			default: