| Subject | Suspend 2 merge: 18/51: Debug page_alloc support. | From | Nigel Cunningham <> | Date | Wed, 24 Nov 2004 23:58:12 +1100 |
| |
This patch provides support for making suspend work when DEBUG_PAGEALLOC is enabled.
diff -ruN 510-debug-pagealloc-support-old/arch/i386/mm/pageattr.c 510-debug-pagealloc-support-new/arch/i386/mm/pageattr.c --- 510-debug-pagealloc-support-old/arch/i386/mm/pageattr.c 2004-11-03 21:53:39.000000000 +1100 +++ 510-debug-pagealloc-support-new/arch/i386/mm/pageattr.c 2004-11-04 16:27:40.000000000 +1100 @@ -211,5 +213,49 @@ EXPORT_SYMBOL(kernel_map_pages); #endif +#ifdef CONFIG_SOFTWARE_SUSPEND2 +#ifdef CONFIG_DEBUG_PAGEALLOC +static int page_is_kernel_mapped(struct page * page) +{ + pte_t *kpte; + unsigned long address; + +#ifdef CONFIG_HIGHMEM + if (page >= highmem_start_page) + return 0; +#endif + + address = (unsigned long)page_address(page); + + kpte = lookup_address(address); + if (!kpte) + return 0; + + if (pte_same(*kpte, mk_pte(page, PAGE_KERNEL))) + return 1; + + return 0; +} + +int suspend_map_kernel_page(struct page * page, int enable) +{ + int is_already_mapped = page_is_kernel_mapped(page); + + if (enable == is_already_mapped) + return 1; + + kernel_map_pages(page, 1, enable); + + return 0; +} +#else +int suspend_map_kernel_page(struct page * page, int enable) +{ + return (enable == 1); +} +#endif +EXPORT_SYMBOL(suspend_map_kernel_page); +#endif + EXPORT_SYMBOL(change_page_attr); EXPORT_SYMBOL(global_flush_tlb);
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|