380 |
381 |
381 case SPageInfo::EPagedPinnedMoved: |
382 case SPageInfo::EPagedPinnedMoved: |
382 // This page was pinned when it was moved but it has not been returned |
383 // This page was pinned when it was moved but it has not been returned |
383 // to the free pool yet so make sure it is... |
384 // to the free pool yet so make sure it is... |
384 aPageInfo->SetPagedState(SPageInfo::EUnpaged); // Must be unpaged before returned to free pool. |
385 aPageInfo->SetPagedState(SPageInfo::EUnpaged); // Must be unpaged before returned to free pool. |
385 return KErrNotFound; |
386 return KErrCompletion; |
386 |
387 |
387 default: |
388 default: |
388 __NK_ASSERT_DEBUG(0); |
389 __NK_ASSERT_DEBUG(0); |
389 return KErrNotFound; |
390 return KErrNotFound; |
390 } |
391 } |
391 |
392 |
392 // Update the dirty page count as required... |
393 // Update the dirty page count as required... |
393 if (aPageInfo->IsDirty()) |
394 if (aPageInfo->IsDirty()) |
394 SetClean(*aPageInfo); |
395 SetClean(*aPageInfo); |
395 |
396 |
|
397 if (iNumberOfFreePages > 0) |
|
398 {// The paging cache is not at the minimum size so safe to let the |
|
399 // ram allocator free this page. |
|
400 iNumberOfFreePages--; |
|
401 aPageInfo->SetPagedState(SPageInfo::EUnpaged); |
|
402 return KErrCompletion; |
|
403 } |
|
404 // Need to hold onto this page as have reached the page cache limit. |
396 // add as oldest page... |
405 // add as oldest page... |
397 #ifdef _USE_OLDEST_LISTS |
406 #ifdef _USE_OLDEST_LISTS |
398 aPageInfo->SetPagedState(SPageInfo::EPagedOldestClean); |
407 aPageInfo->SetPagedState(SPageInfo::EPagedOldestClean); |
399 iOldestCleanList.Add(&aPageInfo->iLink); |
408 iOldestCleanList.Add(&aPageInfo->iLink); |
400 ++iOldestCleanCount; |
409 ++iOldestCleanCount; |
785 __NK_ASSERT_DEBUG(MmuLock::IsHeld()); |
794 __NK_ASSERT_DEBUG(MmuLock::IsHeld()); |
786 |
795 |
787 __NK_ASSERT_DEBUG(iNumberOfFreePages>0); |
796 __NK_ASSERT_DEBUG(iNumberOfFreePages>0); |
788 --iNumberOfFreePages; |
797 --iNumberOfFreePages; |
789 |
798 |
|
799 // The page must be unpaged, otherwise it wasn't successfully removed |
|
800 // from the live list. |
|
801 __NK_ASSERT_DEBUG(aPageInfo.PagedState() == SPageInfo::EUnpaged); |
790 MmuLock::Unlock(); |
802 MmuLock::Unlock(); |
791 |
803 |
792 TPhysAddr pagePhys = aPageInfo.PhysAddr(); |
804 TPhysAddr pagePhys = aPageInfo.PhysAddr(); |
793 TheMmu.FreeRam(&pagePhys, 1, EPageDiscard); |
805 TheMmu.FreeRam(&pagePhys, 1, EPageDiscard); |
794 |
806 |