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 physicalmemory 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 entriesin that /proc file than they have pages of total memory.

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

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