aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorXishi Qiu <qiuxishi@huawei.com>2013-11-12 18:07:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 22:09:03 -0500
commitc1ce4b375fa7b76d8b553d4f8d6cc5a09f063691 (patch)
tree50ed8b8cdfbbd6ae59c99f9650a24192be3aa34b /arch
parent9e4be4708e9e88da46ae1f0bb1054c3619cc476e (diff)
mm/arch: use __free_reserved_page() to simplify the code
Use __free_reserved_page() to simplify the code in arch. It used split_page() in consistent_alloc()/__dma_alloc_coherent()/dma_alloc_coherent(), so page->_count == 1, and we can free it safely. __free_reserved_page() ClearPageReserved() init_page_count() // it won't change the value __free_page() Signed-off-by: Xishi Qiu <qiuxishi@huawei.com> Cc: James Hogan <james.hogan@imgtec.com> Cc: Michal Simek <monstr@monstr.eu> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/metag/kernel/dma.c4
-rw-r--r--arch/microblaze/mm/consistent.c7
-rw-r--r--arch/powerpc/mm/dma-noncoherent.c4
3 files changed, 4 insertions, 11 deletions
diff --git a/arch/metag/kernel/dma.c b/arch/metag/kernel/dma.c
index 8c00dedadc54..db589ad5dbc4 100644
--- a/arch/metag/kernel/dma.c
+++ b/arch/metag/kernel/dma.c
@@ -305,9 +305,7 @@ void dma_free_coherent(struct device *dev, size_t size,
305 305
306 if (pfn_valid(pfn)) { 306 if (pfn_valid(pfn)) {
307 struct page *page = pfn_to_page(pfn); 307 struct page *page = pfn_to_page(pfn);
308 ClearPageReserved(page); 308 __free_reserved_page(page);
309
310 __free_page(page);
311 continue; 309 continue;
312 } 310 }
313 } 311 }
diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c
index 5226b09cbbb2..dbbf2246a260 100644
--- a/arch/microblaze/mm/consistent.c
+++ b/arch/microblaze/mm/consistent.c
@@ -176,8 +176,7 @@ void consistent_free(size_t size, void *vaddr)
176 page = virt_to_page(vaddr); 176 page = virt_to_page(vaddr);
177 177
178 do { 178 do {
179 ClearPageReserved(page); 179 __free_reserved_page(page);
180 __free_page(page);
181 page++; 180 page++;
182 } while (size -= PAGE_SIZE); 181 } while (size -= PAGE_SIZE);
183#else 182#else
@@ -194,9 +193,7 @@ void consistent_free(size_t size, void *vaddr)
194 pte_clear(&init_mm, (unsigned int)vaddr, ptep); 193 pte_clear(&init_mm, (unsigned int)vaddr, ptep);
195 if (pfn_valid(pfn)) { 194 if (pfn_valid(pfn)) {
196 page = pfn_to_page(pfn); 195 page = pfn_to_page(pfn);
197 196 __free_reserved_page(page);
198 ClearPageReserved(page);
199 __free_page(page);
200 } 197 }
201 } 198 }
202 vaddr += PAGE_SIZE; 199 vaddr += PAGE_SIZE;
diff --git a/arch/powerpc/mm/dma-noncoherent.c b/arch/powerpc/mm/dma-noncoherent.c
index 6747eece84af..7b6c10750179 100644
--- a/arch/powerpc/mm/dma-noncoherent.c
+++ b/arch/powerpc/mm/dma-noncoherent.c
@@ -287,9 +287,7 @@ void __dma_free_coherent(size_t size, void *vaddr)
287 pte_clear(&init_mm, addr, ptep); 287 pte_clear(&init_mm, addr, ptep);
288 if (pfn_valid(pfn)) { 288 if (pfn_valid(pfn)) {
289 struct page *page = pfn_to_page(pfn); 289 struct page *page = pfn_to_page(pfn);
290 290 __free_reserved_page(page);
291 ClearPageReserved(page);
292 __free_page(page);
293 } 291 }
294 } 292 }
295 addr += PAGE_SIZE; 293 addr += PAGE_SIZE;