]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Clear dirty bits etc on compound frees
authorAndrew Morton <akpm@osdl.org>
Mon, 29 Dec 2003 13:52:55 +0000 (05:52 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Mon, 29 Dec 2003 13:52:55 +0000 (05:52 -0800)
From: "Martin J. Bligh" <mbligh@aracnet.com>,
      Guillaume Morin <guillaume@morinfr.org>

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

index 49f9d1ca3625c612120e81aaea22d6a87f2b574f..622364e360a6dc0f3bc77d49b11ac7a218bba71d 100644 (file)
@@ -267,9 +267,11 @@ free_pages_bulk(struct zone *zone, int count,
 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);