Re: [BUGFIX][PATCH] Aditional fix for memmap initalization

From: KAMEZAWA Hiroyuki
Date: Tue Feb 10 2009 - 09:27:31 EST


Mel Gorman wrote:
> It feels like we are changing more than we need to.
agreed.

> Could we achieve the same
> fix by just altering early_pfn_in_nid() to return true if the PFN matches
> the NID or is in a hole and ok to initialise. Something like this patch
> maybe?
>
yes, maybe.
It seems there is no additional bug report and it seems good to write
simpler patch. I'll try a replacement in this week.

Regards,
-Kame

> =====
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index 09c14e2..c3140df 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -1070,11 +1070,7 @@ void sparse_init(void);
> #define sparse_index_init(_sec, _nid) do {} while (0)
> #endif /* CONFIG_SPARSEMEM */
>
> -#ifdef CONFIG_NODES_SPAN_OTHER_NODES
> -#define early_pfn_in_nid(pfn, nid) (early_pfn_to_nid(pfn) == (nid))
> -#else
> -#define early_pfn_in_nid(pfn, nid) (1)
> -#endif
> +int __meminit early_pfn_in_nid(unsigned long pfn, int nid);
>
> #ifndef early_pfn_valid
> #define early_pfn_valid(pfn) (1)
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 5675b30..708837e 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -3005,6 +3005,34 @@ int __meminit early_pfn_to_nid(unsigned long pfn)
> }
> #endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
>
> +#ifdef CONFIG_NODES_SPAN_OTHER_NODES
> +/*
> + * Returns true if the PFN is within the NID or it is within a hole.
> + * If the PFN is in a hole, we still initialise the memmap so that
> + * walkers of the memmap do not get confused
> + */
> +int __meminit early_pfn_in_nid(unsigned long pfn, int nid)
> +{
> + int i;
> +
> + for (i = 0; i < nr_nodemap_entries; i++) {
> + unsigned long start_pfn = early_node_map[i].start_pfn;
> + unsigned long end_pfn = early_node_map[i].end_pfn;
> +
> + if (start_pfn <= pfn && pfn < end_pfn)
> + return early_node_map[i].nid == nid;
> + }
> +
> + /* The PFN is within a hole so it'll be ok to initialise */
> + return 1;
> +}
> +#else
> +int __meminit early_pfn_in_nid(unsigned long pfn, int nid)
> +{
> + return 1;
> +}
> +#endif
> +
> /* Basic iterator support to walk early_node_map[] */
> #define for_each_active_range_index_in_nid(i, nid) \
> for (i = first_active_region_index_in_nid(nid); i != -1; \
>
> --
> Mel Gorman
> Part-time Phd Student Linux Technology Center
> University of Limerick IBM Dublin Software Lab
> --
> 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/
>


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