Re: [PATCH 1 of 6] hotplug-memory: refactor online_pages toseparate zone growth from page onlining

From: Dave Hansen
Date: Thu Apr 03 2008 - 21:07:00 EST



On Thu, 2008-04-03 at 17:05 -0700, Jeremy Fitzhardinge wrote:
>
> +static void grow_zone_span(unsigned long start_pfn, unsigned long
> end_pfn)
> +{
> unsigned long old_zone_end_pfn;
> + struct zone *zone;
> + unsigned long flags;
> +
> + /*
> + * This doesn't need a lock to do pfn_to_page().
> + * The section can't be removed here because of the
> + * memory_block->state_sem.
> + */
> + zone = page_zone(pfn_to_page(start_pfn));
> + pgdat_resize_lock(zone->zone_pgdat, &flags);
>
> zone_span_writelock(zone);
>
> @@ -149,19 +171,9 @@
> zone->zone_start_pfn;
>
> zone_span_writeunlock(zone);
> -}
>
> -static void grow_pgdat_span(struct pglist_data *pgdat,
> - unsigned long start_pfn, unsigned long end_pfn)
> -{
> - unsigned long old_pgdat_end_pfn =
> - pgdat->node_start_pfn + pgdat->node_spanned_pages;
> -
> - if (start_pfn < pgdat->node_start_pfn)
> - pgdat->node_start_pfn = start_pfn;
> -
> - pgdat->node_spanned_pages = max(old_pgdat_end_pfn, end_pfn) -
> - pgdat->node_start_pfn;
> + grow_pgdat_span(zone->zone_pgdat, start_pfn, end_pfn);
> + pgdat_resize_unlock(zone->zone_pgdat, &flags);
> }
>
> static int online_pages_range(unsigned long start_pfn, unsigned long
> nr_pages,
> @@ -180,16 +192,12 @@
> return 0;
> }

I don't particularly like this change to have grow_pgdat_span() called
*from* grow_zone_span(). Seems backwards to me. But, this diff look
funny (not your fault) so I may just be seeing things. :)

-- Dave

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