Thread (14 messages) 14 messages, 7 authors, 2011-08-23

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

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2011-08-22 20:44:24
Also in: lkml

On Tue, 23 Aug 2011 01:29:06 +0900
Akinobu Mita [off-list ref] 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@kvack.org.  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@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help