linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <haveblue@us.ibm.com>
To: akpm@osdl.org
Cc: alexn@dsv.su.se, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Dave Hansen <haveblue@us.ibm.com>
Subject: [PATCH] make page_owner handle non-contiguous page ranges
Date: Thu, 03 Feb 2005 13:50:19 -0800	[thread overview]
Message-ID: <E1Cwork-0006No-00@kernel.beaverton.ibm.com> (raw)

While super-nifty, the new page_owner code assumes a contiguous
mem_map, which we don't all have.  This patch changes the
iterator in the read_page_owner() to be a pfn instead of a
'struct page'.  This makes it easy to jump around to different
non-contiuous 'struct pages' as with the CONFIG_DISCONTIG code.

It also uses pfn_valid() instead of max_pfn, which seems to be
a bit more flexible, and handles holes where there are no 
'struct pages' on the DISCONTIG systems.

BTW, I have no idea why that loop ended with a continue;

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

 memhotplug-dave/fs/proc/proc_misc.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff -puN fs/proc/proc_misc.c~A9-page_owner_no_contig fs/proc/proc_misc.c
--- memhotplug/fs/proc/proc_misc.c~A9-page_owner_no_contig	2005-02-03 13:26:47.000000000 -0800
+++ memhotplug-dave/fs/proc/proc_misc.c	2005-02-03 13:28:13.000000000 -0800
@@ -546,8 +546,9 @@ static struct file_operations proc_sysrq
 static ssize_t
 read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos)
 {
-	struct page *start = pfn_to_page(min_low_pfn);
-	static struct page *page;
+	unsigned long start_pfn = min_low_pfn;
+	static unsigned long pfn;
+	struct page *page;
 	char *kbuf, *modname;
 	const char *symname;
 	int ret = 0, next_idx = 1;
@@ -555,15 +556,18 @@ read_page_owner(struct file *file, char 
 	unsigned long offset = 0, symsize;
 	int i;
 
-	page = start + *ppos;
-	for (; page < pfn_to_page(max_pfn); page++) {
+	pfn = start_pfn + *ppos;
+	page = pfn_to_page(pfn);
+	for (; pfn < max_pfn; pfn++) {
+		if (!pfn_valid(pfn))
+			continue;
+		page = pfn_to_page(pfn);
 		if (page->order >= 0)
 			break;
 		next_idx++;
-		continue;
 	}
 
-	if (page >= pfn_to_page(max_pfn))
+	if (!pfn_valid(pfn))
 		return 0;
 
 	*ppos += next_idx;
_
--
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:"aart@kvack.org"> aart@kvack.org </a>

                 reply	other threads:[~2005-02-03 21:50 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=E1Cwork-0006No-00@kernel.beaverton.ibm.com \
    --to=haveblue@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=alexn@dsv.su.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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