All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <haveblue@us.ibm.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, Dave Hansen <haveblue@us.ibm.com>
Subject: [PATCH 04/11] memory hotplug prep: fixup bad_range()
Date: Fri, 02 Sep 2005 13:56:46 -0700	[thread overview]
Message-ID: <20050902205646.1D7619DA@kernel.beaverton.ibm.com> (raw)
In-Reply-To: <20050902205643.9A4EC17A@kernel.beaverton.ibm.com>


When doing memory hotplug operations, the size of existing zones can
obviously change.  This means that zone->zone_{start_pfn,spanned_pages}
can change.

There are currently no locks that protect these structure members.
However, they are rarely accessed at runtime.  Outside of swsusp, the
only place that I can find is bad_range().

So, split bad_range() up into two pieces: one that needs to be locked
and anther that doesn't.

Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
---

 memhotplug-dave/mm/page_alloc.c |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diff -puN mm/page_alloc.c~C5.1-bad_range-rework mm/page_alloc.c
--- memhotplug/mm/page_alloc.c~C5.1-bad_range-rework	2005-08-18 14:59:45.000000000 -0700
+++ memhotplug-dave/mm/page_alloc.c	2005-08-18 14:59:45.000000000 -0700
@@ -77,21 +77,37 @@ int min_free_kbytes = 1024;
 unsigned long __initdata nr_kernel_pages;
 unsigned long __initdata nr_all_pages;
 
-/*
- * Temporary debugging check for pages not lying within a given zone.
- */
-static int bad_range(struct zone *zone, struct page *page)
+static int page_outside_zone_boundaries(struct zone *zone, struct page *page)
 {
 	if (page_to_pfn(page) >= zone->zone_start_pfn + zone->spanned_pages)
 		return 1;
 	if (page_to_pfn(page) < zone->zone_start_pfn)
 		return 1;
+
+	return 0;
+}
+
+static int page_is_consistent(struct zone *zone, struct page *page)
+{
 #ifdef CONFIG_HOLES_IN_ZONE
 	if (!pfn_valid(page_to_pfn(page)))
-		return 1;
+		return 0;
 #endif
 	if (zone != page_zone(page))
+		return 0;
+
+	return 1;
+}
+/*
+ * Temporary debugging check for pages not lying within a given zone.
+ */
+static int bad_range(struct zone *zone, struct page *page)
+{
+	if (page_outside_zone_boundaries(zone, page))
 		return 1;
+	if (!page_is_consistent(zone, page))
+		return 1;
+
 	return 0;
 }
 
_

  parent reply	other threads:[~2005-09-02 20:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-02 20:56 [PATCH 01/11] memory hotplug prep: kill local_mapnr Dave Hansen
2005-09-02 20:56 ` [PATCH 02/11] memory hotplug prep: break out zone initialization Dave Hansen
2005-09-02 20:56 ` [PATCH 03/11] memory hotplug prep: __section_nr helper Dave Hansen
2005-09-03 14:59   ` Denis Vlasenko
2005-09-02 20:56 ` Dave Hansen [this message]
2005-09-02 20:56 ` [PATCH 06/11] memory hotplug locking: zone span seqlock Dave Hansen
2005-09-02 20:56 ` [PATCH 05/11] memory hotplug locking: node_size_lock Dave Hansen
2005-09-02 20:56 ` [PATCH 07/11] memory hotplug: sysfs and add/remove functions Dave Hansen
2005-09-02 22:13   ` Andrew Morton
2005-09-02 22:18     ` Dave Hansen
2005-09-02 20:56 ` [PATCH 08/11] memory hotplug: move section_mem_map alloc to sparse.c Dave Hansen
2005-09-02 20:56 ` [PATCH 09/11] memory hotplug: call setup_per_zone_pages_min after hotplug Dave Hansen
2005-09-02 20:56 ` [PATCH 10/11] memory hotplug: i386 addition functions Dave Hansen
2005-09-02 20:56 ` [PATCH 11/11] memory hotplug: ppc64 specific hot-add functions Dave Hansen
2005-09-07  9:37 ` [PATCH 01/11] memory hotplug prep: kill local_mapnr Andrew Morton
2005-09-07 17:03   ` Dave Hansen

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=20050902205646.1D7619DA@kernel.beaverton.ibm.com \
    --to=haveblue@us.ibm.com \
    --cc=akpm@osdl.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.