From: "Jan Beulich" <JBeulich@novell.com>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Rusty Russell <rusty@rustcorp.com.au>
Subject: [PATCH] fix updating of num_physpages for hot plugged memory
Date: Tue, 18 Aug 2009 16:33:41 +0100 [thread overview]
Message-ID: <4A8AE5F50200007800010536@vpn.id2.novell.com> (raw)
Sizing of memory allocations shouldn't depend on the number of physical
pages found in a system, as that generally includes (perhaps a huge
amount of) non-RAM pages. The amount of what actually is usable as
storage should instead be used as a basis here.
In line with that, the memory hotplug code should update num_physpages
in a way that it retains its original (post-boot) meaning; in
particular, decreasing the value should at best be done with great care
- this patch doesn't try to ever decrease this value at all as it
doesn't really seem meaningful to do so.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
---
mm/memory_hotplug.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- linux-2.6.31-rc6/mm/memory_hotplug.c 2009-08-18 15:31:56.000000000 +0200
+++ 2.6.31-rc6-use-totalram_pages/mm/memory_hotplug.c 2009-08-17 15:21:19.000000000 +0200
@@ -339,8 +339,11 @@ EXPORT_SYMBOL_GPL(__remove_pages);
void online_page(struct page *page)
{
+ unsigned long pfn = page_to_pfn(page);
+
totalram_pages++;
- num_physpages++;
+ if (pfn >= num_physpages)
+ num_physpages = pfn + 1;
#ifdef CONFIG_HIGHMEM
if (PageHighMem(page))
@@ -831,7 +834,6 @@ repeat:
zone->present_pages -= offlined_pages;
zone->zone_pgdat->node_present_pages -= offlined_pages;
totalram_pages -= offlined_pages;
- num_physpages -= offlined_pages;
setup_per_zone_wmarks();
calculate_zone_inactive_ratio(zone);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
reply other threads:[~2009-08-18 15:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4A8AE5F50200007800010536@vpn.id2.novell.com \
--to=jbeulich@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rusty@rustcorp.com.au \
/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