From: Dave Hansen <haveblue@us.ibm.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
LHMS <lhms-devel@lists.sourceforge.net>
Subject: Re: [Lhms-devel] [RFC][PATCH] hot add memory which is not aligned to section
Date: Mon, 01 May 2006 07:56:32 -0700 [thread overview]
Message-ID: <1146495392.32079.12.camel@localhost.localdomain> (raw)
In-Reply-To: <20060427223705.e99bb194.kamezawa.hiroyu@jp.fujitsu.com>
On Thu, 2006-04-27 at 22:37 +0900, KAMEZAWA Hiroyuki wrote:
> @@ -145,10 +148,26 @@
> if (!populated_zone(zone))
> need_zonelists_rebuild = 1;
>
> - for (i = 0; i < nr_pages; i++) {
> - struct page *page = pfn_to_page(pfn + i);
> - online_page(page);
> - onlined_pages++;
> + res.start = (u64)pfn << PAGE_SHIFT;
> + res.end = res.start + ((u64)nr_pages << PAGE_SHIFT) - 1;
> + section_end = res.end;
> +
> + while (find_next_system_ram(&res)) {
> + start_pfn = (unsigned long)(res.start >> PAGE_SHIFT);
> + nr_pages = (unsigned long)
> + ((res.end + 1 - res.start) >> PAGE_SHIFT);
> +
> + if (PageReserved(pfn_to_page(start_pfn))) {
> + /* this region's page is not populated now */
> + for (i = 0; i < nr_pages; i++) {
> + struct page *page = pfn_to_page(start_pfn + i);
> + online_page(page);
> + onlined_pages++;
> + }
> + }
> +
> + res.start = res.end + 1;
> + res.end = section_end;
> }
> zone->present_pages += onlined_pages;
> zone->zone_pgdat->node_present_pages += onlined_pages;
First of all, bravo for doing this in an architecture-independent way.
Very nice.
I'd really prefer to keep the 'struct resource' handling out of the
memory hotplug code. This took a nice, little, comprehensible for loop,
and made it quite a bit more complex. There is also a lot of casting
going on, which I don't really grasp in a first glance.
The 'struct resource' which gets passed into find_next_system_ram()
isn't a real resource. Why not just pass a normal start and end address
in there, and let _it_ do the work?
It looks like that whole loop is optimized for being able to online a
really sparse area without diving into the iomem tables very often.
This seems like a premature complicating optimization to me.
Why not do something like this:
for (i = 0; i < nr_pages; i++) {
struct page *page = pfn_to_page(pfn + i);
if (page_is_in_io_resource(page))
continue;
online_page(page);
onlined_pages++;
}
That way, you keep the memory_hotplug.c file nice and neat.
Also, remind me again why you can't just make the SECTION_SIZE match
your 64MB I/O hole sizes. I forget a lot/ :)
-- Dave
next prev parent reply other threads:[~2006-05-01 14:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-27 13:37 KAMEZAWA Hiroyuki
2006-05-01 14:56 ` Dave Hansen [this message]
2006-05-02 1:27 ` [Lhms-devel] " KAMEZAWA Hiroyuki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1146495392.32079.12.camel@localhost.localdomain \
--to=haveblue@us.ibm.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=lhms-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®