Re: [PATCH 13/13] maps#2: Add /proc/kpagemap interface

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Matt Mackall <mpm@...>
Cc: Andrew Morton <akpm@...>, <linux-kernel@...>
Date: Thursday, April 19, 2007 - 4:25 pm

On Thu, 2007-04-19 at 15:02 -0500, Matt Mackall wrote:

pfn_valid() will at least guarantee that pfn_to_page() will give you
_some_ 'struct page' back.  

However, it isn't an absolute guarantee that there is actual physical
memory backing that struct page.  For your use here, it should be OK,
but it might be a bit confusing if anyone ever ends up with more entries
in that /proc file than they have pages of total memory.

But, this is a pretty low-level debugging mechanism, and I'm not sure
this is very easy to solve in an arch-independent way.

I'd probably just leave it looking something like this:

+               for (; i < 2 * chunk / KPMSIZE; i += 2, pfn++) {
+                       if (!pfn_valid(pfn)) {
+                              page[i] = 0;
+                              page[i + 1] = 0;
+                       } else {
+	                       ppage = pfn_to_page(pfn);
+                              page[i] = ppage->flags;
+                              page[i + 1] = atomic_read(&ppage->_count);
+                       }
+               } 

BTW, page->flags can be quite config-dependent on how stuff is stored in
there, especially with the zone, node, and section information encoded
in there.  Do you, perhaps, want to just spit out the bits that are
actual PageFoo() flags?

-- Dave

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 6/13] maps#2: Move the page walker code to lib/, Matt Mackall, (Fri Apr 6, 6:03 pm)
[PATCH 13/13] maps#2: Add /proc/kpagemap interface, Matt Mackall, (Fri Apr 6, 6:03 pm)
Re: [PATCH 13/13] maps#2: Add /proc/kpagemap interface, Dave Hansen, (Thu Apr 19, 3:06 pm)
Re: [PATCH 13/13] maps#2: Add /proc/kpagemap interface, Matt Mackall, (Thu Apr 19, 4:02 pm)
Re: [PATCH 13/13] maps#2: Add /proc/kpagemap interface, Dave Hansen, (Thu Apr 19, 4:25 pm)
[PATCH 12/13] maps#2: Add /proc/pid/pagemap interface, Matt Mackall, (Fri Apr 6, 6:03 pm)
[PATCH 9/13] maps#2: Regroup task_mmu by interface, Matt Mackall, (Fri Apr 6, 6:03 pm)