Re: [PATCH] [6/8] Account overlapped mappings in end_pfn_map
From: Ingo Molnar
Date: Mon Feb 11 2008 - 08:09:18 EST
* Andi Kleen <ak@xxxxxxx> wrote:
> When end_pfn is not aligned to 2MB (or 1GB) then the kernel might map
> more memory than end_pfn. Account this in end_pfn_mapped.
can you see any practical relevance? Your patch description only deals
with the mechanical details of the change instead of analyzing the most
important thing: relevance and impact analysis. That makes it harder to
add your patches and easier to miss a good fix accidentally. It also
makes it quite a bit harder to trust your patches.
at a quick glance the relevance is to EFI only, in
efi_enter_virtual_mode(). max_pfn_mapped is used as a differentiator
between __va() and efi_ioremap(). AFAICS EFI will typically have its
runtime code not right after the end of physical memory.
Nevertheless, i do agree that the max_pfn_mapped/end_pfn_map limit needs
to be sharpened to reflect reality (for later PAT support).
your patch is also a bit unclean:
> -static void __meminit
> +static unsigned long __meminit
> phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end)
> {
> + unsigned long r;
> pmd_t *pmd = pmd_offset(pud, 0);
> spin_lock(&init_mm.page_table_lock);
> - phys_pmd_init(pmd, address, end);
> + r = phys_pmd_init(pmd, address, end);
> spin_unlock(&init_mm.page_table_lock);
> __flush_tlb_all();
> + return r;
> }
a meaningless "r" parameter. Use "true_end" instead.
and here's another type of variable naming problem:
> +unsigned long __init_refok
> +init_memory_mapping(unsigned long start, unsigned long end)
> {
> - unsigned long next;
> + unsigned long next, true_end = end;
that "true_end" is already a _pfn_, so name it accordingly:
true_end_pfn. Because we switch between pfn and addr types it's
important to point out where it's pfn and where it's a linear/physical
address.
> struct zone *zone = pgdat->node_zones + ZONE_NORMAL;
> unsigned long start_pfn = start >> PAGE_SHIFT;
> unsigned long nr_pages = size >> PAGE_SHIFT;
> + unsigned long r;
> int ret;
>
> - init_memory_mapping(start, start + size-1);
> + r = init_memory_mapping(start, start + size-1);
> + if (r > end_pfn_map)
> + end_pfn_map = r;
rename "r" to "true_end_pfn".
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/