Re: Weirdness in __alloc_bootmem_node_high

From: Yinghai Lu
Date: Tue Apr 17 2012 - 13:12:27 EST


On Tue, Apr 17, 2012 at 8:55 AM, Michal Hocko <mhocko@xxxxxxx> wrote:
> Hi,
> I just come across the following condition in __alloc_bootmem_node_high
> which I have hard times to understand. I guess it is a bug and we need
> something like the following. But, to be honest, I have no idea why we
> care about those 128MB above MAX_DMA32_PFN.
> ---
>  mm/bootmem.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/bootmem.c b/mm/bootmem.c
> index 0131170..5adb072 100644
> --- a/mm/bootmem.c
> +++ b/mm/bootmem.c
> @@ -737,7 +737,7 @@ void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size,
>        /* update goal according ...MAX_DMA32_PFN */
>        end_pfn = pgdat->node_start_pfn + pgdat->node_spanned_pages;
>
> -       if (end_pfn > MAX_DMA32_PFN + (128 >> (20 - PAGE_SHIFT)) &&
> +       if (end_pfn > MAX_DMA32_PFN + (128 << (20 - PAGE_SHIFT)) &&
>            (goal >> PAGE_SHIFT) < MAX_DMA32_PFN) {
>                void *ptr;
>                unsigned long new_goal;
> --

We are not using bootmem with x86 now, so could remove those workaround now.

Thanks

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