Re: how to tell if arbitrary kernel memory address is backed by physicalmemory?

From: Chris Friesen
Date: Fri Apr 17 2009 - 12:15:45 EST


Christoph Lameter wrote:
On Thu, 16 Apr 2009, Chris Friesen wrote:

Is there a portable way to tell whether a particular virtual address in the
lowmem address range is backed by physical memory and is readable?

For background...we have some guys working on a software memory scrubber for
an embedded board. The memory controller supports ECC but doesn't support
scrubbing in hardware. What we want to do is walk all of lowmem, reading in
memory. If a fault is encountered, it will be handled by other code.

Virtual address in the lowmem address range? lowmem address ranges exist
for physical addresses.

If you walk lowmem (physical) then you will never see a missing page.

We have a mips board that appears to have holes in the lowmem mappings such that blindly walking all of it causes problems. I assume the allocator knows about these holes and simply doesn't assign memory at those addresses.

We may have found a solution though...it looks like virt_addr_valid() returns false for the problematic addresses. Would it be reasonable to call this once for each page before trying to access it?

Chris

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/