--- a/kernel/eka/memmodel/epoc/flexible/mmu/mptalloc.cpp Wed May 05 05:11:16 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mptalloc.cpp Mon May 10 11:40:53 2010 +0100
@@ -54,10 +54,6 @@
uses memory from #ThePager which will reclaim paged memory if necessary.
Providing the live list always has #DPager::iMinYoungPages, this guarantees that
handling page faults can never fail by running out of memory.
-
-TODO: In really pathological situations page table allocation can fail due to
-being out of virtual address space to map the table, this needs to be prevented
-from happening when handling demand paging faults.
*/
@@ -177,6 +173,14 @@
else
{// Allocate fixed paged as page tables aren't movable.
r = TheMmu.AllocRam(&pagePhys, 1, aMemory->RamAllocFlags(), EPageFixed);
+
+#ifdef BTRACE_KERNEL_MEMORY
+ if (r == KErrNone)
+ {
+ BTrace4(BTrace::EKernelMemory, BTrace::EKernelMemoryMiscAlloc, KPageSize);
+ ++Epoc::KernelMiscPages;
+ }
+#endif
}
RamAllocLock::Unlock();
@@ -241,7 +245,14 @@
if(aDemandPaged)
ThePager.PageInFreePages(&pagePhys,1);
else
+ {
TheMmu.FreeRam(&pagePhys, 1, EPageFixed);
+
+#ifdef BTRACE_KERNEL_MEMORY
+ BTrace4(BTrace::EKernelMemory, BTrace::EKernelMemoryMiscFree, KPageSize);
+ --Epoc::KernelMiscPages;
+#endif
+ }
r = 1;
}
@@ -362,11 +373,8 @@
{
iReserveCount = aReserveCount;
iDemandPaged = aDemandPaged;
- while(iFreeCount<aReserveCount)
- if(!aAllocator->AllocReserve(*this))
- {
- __NK_ASSERT_ALWAYS(0);
- }
+ while(iFreeCount < aReserveCount)
+ __NK_ASSERT_ALWAYS(aAllocator->AllocReserve(*this));
}