Re: [PATCH 2/4] debug-pagealloc: add support for highmem pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 23 Aug 2011 01:29:06 +0900
Akinobu Mita <akinobu.mita@xxxxxxxxx> wrote:

> This adds support for highmem pages poisoning and verification to the
> debug-pagealloc feature for no-architecture support.
> 
> ...
>
>  static void poison_page(struct page *page)
>  {
>  	void *addr;
> -
> -	if (PageHighMem(page)) {
> -		poison_highpage(page);
> -		return;
> +	unsigned long flags;
> +	bool highmem = PageHighMem(page);
> +
> +	if (highmem) {
> +		local_irq_save(flags);
> +		addr = kmap_atomic(page);
> +	} else {
> +		addr = page_address(page);
>  	}
>  	set_page_poison(page);
> -	addr = page_address(page);
>  	memset(addr, PAGE_POISON, PAGE_SIZE);
> +
> +	if (highmem) {
> +		kunmap_atomic(addr);
> +		local_irq_restore(flags);
> +	}
>  }

This seems more complicated than is needed.  Couldn't we just do

static void poison_page(struct page *page)
{
	void *addr;

	preempt_disable();
	addr = kmap_atomic(page);
	set_page_poison(page);
	memset(addr, PAGE_POISON, PAGE_SIZE);
	kunmap_atomic(addr);
	preempt_enable();
}

?

> +		addr = kmap_atomic(page);

That reminds me - we need to convert every "kmap_atomic(p, foo)" to
"kmap_atomic(p)" then remove the kmap_atomic back-compatibility macro.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]