[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1352789271-18461-1-git-send-email-m.szyprowski@samsung.com>
Date: Tue, 13 Nov 2012 07:47:51 +0100
From: Marek Szyprowski <m.szyprowski@...sung.com>
To: linux-mm@...ck.org, linaro-mm-sig@...ts.linaro.org,
linux-kernel@...r.kernel.org
Cc: Marek Szyprowski <m.szyprowski@...sung.com>,
Kyungmin Park <kyungmin.park@...sung.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Mel Gorman <mel@....ul.ie>,
Michal Nazarewicz <mina86@...a86.com>,
Minchan Kim <minchan@...nel.org>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
Subject: [PATCH v2] mm: cma: WARN if freed memory is still in use
Memory returned to free_contig_range() must have no other references. Let
kernel to complain loudly if page reference count is not equal to 1.
Signed-off-by: Marek Szyprowski <m.szyprowski@...sung.com>
Reviewed-by: Kyungmin Park <kyungmin.park@...sung.com>
CC: Michal Nazarewicz <mina86@...a86.com>
---
mm/page_alloc.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 022e4ed..290c2eb 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5888,8 +5888,13 @@ done:
void free_contig_range(unsigned long pfn, unsigned nr_pages)
{
- for (; nr_pages--; ++pfn)
- __free_page(pfn_to_page(pfn));
+ struct page *page = pfn_to_page(pfn);
+ int count = 0;
+ for (; nr_pages--; page++) {
+ count += page_count(page) != 1;
+ __free_page(page);
+ }
+ WARN(count != 0, "%d pages are still in use!\n", count);
}
#endif
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists