Re: [PATCH] generic debug pagealloc (-v2)

From: Akinobu Mita
Date: Thu Mar 05 2009 - 22:28:33 EST


On Thu, Mar 05, 2009 at 02:31:50PM -0800, Andrew Morton wrote:
> > +#include <linux/kernel.h>
> > +#include <linux/mm.h>
> > +
> > +static void poison_page(struct page *page)
> > +{
> > + void *addr;
> > +
> > + if (PageHighMem(page))
> > + return; /* i goofed */
>
> heh. A more complete comment would be needed here.
>
> Also, as this is a kernel bug, perhaps some sort of runtime warning?

It just skips the poisoning for highmem pages.
Any page poisoning can be skipped safely if it doesn't set the page->poison
flag. So I'm going to put

/*
* skipping the page poisoning for highmem pages
*/

> > + page->poison = true;
> > + addr = page_address(page);
> > + memset(addr, PAGE_POISON, PAGE_SIZE);
> > +}

...

> > +static void unpoison_page(struct page *page)
> > +{
> > + void *addr;
> > +
>
> Shouldn't we check PageHighmem() here also?

It should not happen because page->poison flag is not set for highmem pages.
But it's good for sanity checking. So I'll have a BUG_ON here.

> > + if (!page->poison)
> > + return;
> > +

BUG_ON(PageHighMem(page));

> > + addr = page_address(page);
> > + check_poison_mem(addr, PAGE_SIZE);
> > + page->poison = false;
> > +}
--
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/