From: "Martin J. Bligh" <mbligh@aracnet.com>

We need to clear the software dirty bit on the tail pages of a compound page
when freeing it up.

The tail pages can become dirtied by mmap'ing /dev/mem, and writing into
any clustered page group (that a driver might have created or whatever).

Plus it's better to run all these pages through the free_pages_check checks
anyway.



 mm/page_alloc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

diff -puN mm/page_alloc.c~compound-pages-dirty-page-fix mm/page_alloc.c
--- 25/mm/page_alloc.c~compound-pages-dirty-page-fix	2003-12-14 19:44:55.000000000 -0800
+++ 25-akpm/mm/page_alloc.c	2003-12-14 19:44:55.000000000 -0800
@@ -267,9 +267,11 @@ free_pages_bulk(struct zone *zone, int c
 void __free_pages_ok(struct page *page, unsigned int order)
 {
 	LIST_HEAD(list);
+	int i;
 
 	mod_page_state(pgfree, 1 << order);
-	free_pages_check(__FUNCTION__, page);
+	for (i = 0 ; i < (1 << order) ; ++i)
+		free_pages_check(__FUNCTION__, page + i);
 	list_add(&page->list, &list);
 	kernel_map_pages(page, 1<<order, 0);
 	free_pages_bulk(page_zone(page), 1, &list, order);

_