mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-25 16:11:45 +00:00
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. [rientjes@google.com: support sparsemem] Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
b66c598401
commit
bcc2b02f4c
1 changed files with 9 additions and 2 deletions
|
@ -5978,8 +5978,15 @@ done:
|
||||||
|
|
||||||
void free_contig_range(unsigned long pfn, unsigned nr_pages)
|
void free_contig_range(unsigned long pfn, unsigned nr_pages)
|
||||||
{
|
{
|
||||||
for (; nr_pages--; ++pfn)
|
unsigned int count = 0;
|
||||||
__free_page(pfn_to_page(pfn));
|
|
||||||
|
for (; nr_pages--; pfn++) {
|
||||||
|
struct page *page = pfn_to_page(pfn);
|
||||||
|
|
||||||
|
count += page_count(page) != 1;
|
||||||
|
__free_page(page);
|
||||||
|
}
|
||||||
|
WARN(count != 0, "%d pages are still in use!\n", count);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue