We just discovered that the accounting for initial memory usage (head.S: INIT_MAP_BEYOND_END) has been way, way off for a very long time. This patch makes the initial page table not round up to the nearest 4M boundary, but instead stop dead (and zero the rest of the final page table) as soon as it hits the configured limit.
This patch is intended as a debugging aid. If it goes into the kernel, it should go in at the very beginning of a review cycle, as it may very well expose real failures (without Jeremy's patch to fix the accounting, it *will* crash.) Signed-off-by: H. Peter Anvin <[EMAIL PROTECTED]> diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S index 3fa7f93..db6735a 100644 --- a/arch/i386/kernel/head.S +++ b/arch/i386/kernel/head.S @@ -131,15 +131,27 @@ page_pde_offset = (__PAGE_OFFSET >> 20); movl %ecx,page_pde_offset(%edx) /* Store kernel PDE entry */ addl $4,%edx movl $1024, %ecx + /* + * End condition: we must map up to and including + * INIT_MAP_BEYOND_END bytes beyond the end of our + * own page tables; 0x1000 is the size of the page + * table were about to write, and +0x007 is the + * attribute bits. + */ + leal (INIT_MAP_BEYOND_END+0x1000+0x007)(%edi),%ebp 11: stosl addl $0x1000,%eax - loop 11b - /* End condition: we must map up to and including INIT_MAP_BEYOND_END */ - /* bytes beyond the end of our own page tables; the +0x007 is the attribute bits */ - leal (INIT_MAP_BEYOND_END+0x007)(%edi),%ebp cmpl %ebp,%eax - jb 10b + jae 12f + loop 11b + jmp 10b +12: + /* Clear the remainder of the last page table */ + decl %ecx + xorl %eax,%eax + rep; stosl + movl %edi,(init_pg_tables_end - __PAGE_OFFSET) xorl %ebx,%ebx /* This is the boot CPU (BSP) */ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/