Re: Background memory scrubbing

From: Rik van Riel
Date: Wed Apr 20 2011 - 13:53:53 EST


On 04/20/2011 01:05 PM, Robert Whitton wrote:
On Wed 20/04/11 6:45 PM , Rik van Riel<riel@xxxxxxxxxx> wrote:
On 04/20/2011 03:58 AM, Robert Whitton wrote:

for each PFN from 256 to the highest valid PFN
{
if (pfn_valid(PFN))
{
page = pfn_to_page(PFN)
va = kmap(page)
atomic_scrub(va, PAGE_SIZE)
kunmap(page)
}

sleep(for_a_while)
}

What exactly does atomic_scrub do?

atomic_scrub is part of the edac subsystem see arch/x86/include/asm/edac.h. It simply does a locked add of zero to each DWORD in the specified range.

I can think of only a few ways in which that could cause a
kernel page fault.

One of the more obvious causes would be running into an
area of kernel memory that is mapped read-only. Writing
to a page that is mapped read-only would cause a page
fault :)

Walking the page tables to check whether my guess is correct
should be possible in the current context. Look at current->mm->pgd for the page directory and start walking from there.

Incidentally, the kernel mappings should be the same for any
process, so the above should hold true from any context.
--
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/