diff -r 73ea206103e6 -r 43365a9b78a3 kernel/eka/memmodel/epoc/flexible/mmu/mdefrag.cpp --- a/kernel/eka/memmodel/epoc/flexible/mmu/mdefrag.cpp Wed Jun 23 19:44:53 2010 +0300 +++ b/kernel/eka/memmodel/epoc/flexible/mmu/mdefrag.cpp Tue Jul 06 15:50:07 2010 +0300 @@ -115,14 +115,14 @@ RamAllocLock::Lock(); // Move the page to any RAM zone. - r = M::MovePage(aOld, aNew, KRamZoneInvalidId, EFalse); + r = M::MovePage(aOld, aNew, KRamZoneInvalidId, 0); RamAllocLock::Unlock(); return r; } -TInt M::MovePage(TPhysAddr aOld, TPhysAddr& aNew, TUint aBlockZoneId, TBool aBlockRest) +TInt M::MovePage(TPhysAddr aOld, TPhysAddr& aNew, TUint aBlockZoneId, TUint aMoveDisFlags) { // Returns this when page is not paged or managed or free but is a real RAM page. TInt r = KErrNotSupported; @@ -130,26 +130,22 @@ // get memory object corresponding to the page... DMemoryObject* memory = 0; MmuLock::Lock(); - SPageInfo* pi = SPageInfo::SafeFromPhysAddr(aOld&~KPageMask); - if(pi) + SPageInfo* pi = SPageInfo::SafeFromPhysAddr(aOld & ~KPageMask); + if (pi) { if (pi->PagedState() != SPageInfo::EUnpaged) {// The page is paged so let the pager handle it. - return ThePager.DiscardPage(pi, aBlockZoneId, aBlockRest); + return ThePager.DiscardPage(pi, aBlockZoneId, aMoveDisFlags); } switch (pi->Type()) { case SPageInfo::EManaged: memory = pi->Owner(); - // Note, whilst we hold the RamAllocLock the page can't change it's use - // and we can safely assume that it still belongs to the memory object - // at a fixed page index. - // Also, as memory objects can't be destroyed whilst they still own pages - // we can safely access this object without taking an explicit reference, - // i.e. we don't need to Open() the memory object. - MmuLock::Unlock(); - // move page... - r = memory->iManager->MovePage(memory, pi, aNew, aBlockZoneId, aBlockRest); + memory->Open(); + // move page, this will release the mmu lock. + r = memory->iManager->MovePage( memory, pi, aNew, aBlockZoneId, + (aMoveDisFlags & M::EMoveDisBlockRest)!=0); + memory->AsyncClose(); break; case SPageInfo::EUnused: r = KErrNotFound; // This page is free so nothing to do. @@ -186,15 +182,10 @@ { case SPageInfo::EManaged: memory = pi->Owner(); - // Note, whilst we hold the RamAllocLock the page can't change it's use - // and we can safely assume that it still belongs to the memory object - // at a fixed page index. - // Also, as memory objects can't be destroyed whilst they still own pages - // we can safely access this object without taking an explicit referernce, - // i.e. we don't need to Open() the memory object. - MmuLock::Unlock(); - // move page... + memory->Open(); + // move page, this will release the mmu lock. r = memory->iManager->MoveAndAllocPage(memory, pi, aPageType); + memory->AsyncClose(); break; case SPageInfo::EUnused: r = KErrNone; // This page is free so nothing to do.