From: Nathan Fontenot <nfont@austin.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: Badari Pulavarty <badari@us.ibm.com>
Subject: [PATCH] Use correct page frame number to grab page zone lock
Date: Wed, 29 Oct 2008 12:28:38 -0500 [thread overview]
Message-ID: <49089D46.1090609@austin.ibm.com> (raw)
There are situations in which the 'pfn' variable used to calculate the
page zone can be invalid. One case is in the hotplug memory remove path
where we are trying to remove memory the last valid page frame for the
system. Passing an invalid page frame number to the pfn_to_page() macro
will cause the system to oops.
Additionally I think this also solves an issue where we may be grabbing
the wrong zone->lock. This would occur when 'pfn' refers to a page
frame beyond what we are examining and lies in a different zone.
Using the starting page frame number passed in appears to resolve
both of these issues. This patch also removes the redundant
initialization of 'pfn', it is set explicitly and then again in the for loop.
Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
---
Index: linux-2.6/mm/page_isolation.c
===================================================================
--- linux-2.6.orig/mm/page_isolation.c 2008-10-13 12:00:46.000000000 -0500
+++ linux-2.6/mm/page_isolation.c 2008-10-29 11:18:39.000000000 -0500
@@ -119,7 +119,6 @@
struct zone *zone;
int ret;
- pfn = start_pfn;
/*
* Note: pageblock_nr_page != MAX_ORDER. Then, chunks of free page
* is not aligned to pageblock_nr_pages.
@@ -133,7 +132,7 @@
if (pfn < end_pfn)
return -EBUSY;
/* Check all pages are free or Marked as ISOLATED */
- zone = page_zone(pfn_to_page(pfn));
+ zone = page_zone(pfn_to_page(start_pfn));
spin_lock_irqsave(&zone->lock, flags);
ret = __test_page_isolated_in_pageblock(start_pfn, end_pfn);
spin_unlock_irqrestore(&zone->lock, flags);
next reply other threads:[~2008-10-29 17:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-29 17:28 Nathan Fontenot [this message]
2008-10-29 17:55 ` [PATCH] Use correct page frame number to grab page zone lock Nathan Fontenot
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=49089D46.1090609@austin.ibm.com \
--to=nfont@austin.ibm.com \
--cc=badari@us.ibm.com \
--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