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

From: Jeremy Fitzhardinge
Date: Thu Apr 03 2008 - 21:33:31 EST


Dave Hansen wrote:
On Thu, 2008-04-03 at 17:05 -0700, Jeremy Fitzhardinge wrote:
+int prepare_online_pages(unsigned long pfn, unsigned long nr_pages)
+{
+ int ret = notify_going_online(pfn, nr_pages);
+ if (ret)
+ return ret;
+
+ grow_zone_span(pfn, pfn+nr_pages);
return 0;
+}

OK, after seeing this used in the Xen driver, I'm even less a fan of the
name. Mostly because it doesn't actually prepare *pages* to be onlined.
It prepares the zones/pgdats and notifies that pages might soon be
online. Can you think of any better names?

grow_and_notify...??

Does it even need to be a separately visible function? Could it just be part of add_memory()? Is there any reason delay doing it until online_pages()?

That way online_pages() can return to being the one-stop function to online all the pages, making mark_pages_online() redundant.

It's also a bit funky because you're calling the online notifiers, but
you're not actually onlining the pages, yet. Does that have any
repercussions?

No. It will always call the GOING_ONLINE notifier, but it will only call the ONLINE notifier if it actually bulk-onlines all the pages. In my page-by-page case, it will never end up calling the ONLINE notifier. I could call it repeatedly for each page, but I'm not sure how useful that is (the lack of any users of the ONLINE notifier makes it hard to judge).

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