Re: [PATCH] bootmem.c clean up bad pfn convertions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2005-04-08 at 15:32 +0200, Franck Bui-Huu wrote:
> As I described in my previous email, bootmem.c does improper
> pfn convertions into phys addr. This simple patch fixes that.
...
> -       bdata->node_bootmem_map = phys_to_virt(mapstart << PAGE_SHIFT);
> -       bdata->node_boot_start = (start << PAGE_SHIFT);
> +       bdata->node_bootmem_map = phys_to_virt(pfn_to_phys(mapstart));
> +       bdata->node_boot_start = pfn_to_phys(start);

The only arch with phys_to_pfn() defined is UML, so the patch simply
won't compile anything but UML on current kernels (unless I'm missing
something).

Could you try to give us a more complete description of your problem?  I
know your memory doesn't start at 0x0, but what problems does that
cause?  Does the mem_map[] allocation blow up, etc...  

If it's just mem_map[], That calculation could be fixed pretty easily.
Something like

+#ifdef CONFIG_CRAZY_MIPS_FOO_MEM_MAP_START... 
+extern unsigned long mem_map_start_pfn
+#else
+#define mem_map_start_pfn 0UL
+#endif
-#define pfn_to_page(pfn)        (mem_map + (pfn))
+#define pfn_to_page(pfn)        (mem_map + (pfn) - mem_map_start_pfn)

(those names are horrid, please improve them, if you plan to do this)

All of the zone (and allocator) calculations should be just fine,
because it already has a zone_start_pfn.

-- Dave

-
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/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux