summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
diff options
context:
space:
mode:
authorChris Zankel <chris@zankel.net>2015-08-29 23:55:58 (GMT)
committerChris Zankel <chris@zankel.net>2015-08-29 23:55:58 (GMT)
commit650c919798c71fb34b77a6f2ba03a06907f06a76 (patch)
treed1c60012d4d86846d25f1d0b783b5122c26a2e31 /drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
parent895fb3159280fe7695b35ec7c87ec19e13ca5b6e (diff)
parent64291f7db5bd8150a74ad2036f1037e6a0428df2 (diff)
downloadlinux-650c919798c71fb34b77a6f2ba03a06907f06a76.tar.xz
Merge tag 'v4.2' into for_next
Linux 4.2
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_page_alloc_dma.c')
-rw-r--r--drivers/gpu/drm/ttm/ttm_page_alloc_dma.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
index 3077f15..624d941 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
@@ -963,14 +963,13 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)
} else {
pool->npages_free += count;
list_splice(&ttm_dma->pages_list, &pool->free_list);
- npages = count;
- if (pool->npages_free > _manager->options.max_size) {
+ /*
+ * Wait to have at at least NUM_PAGES_TO_ALLOC number of pages
+ * to free in order to minimize calls to set_memory_wb().
+ */
+ if (pool->npages_free >= (_manager->options.max_size +
+ NUM_PAGES_TO_ALLOC))
npages = pool->npages_free - _manager->options.max_size;
- /* free at least NUM_PAGES_TO_ALLOC number of pages
- * to reduce calls to set_memory_wb */
- if (npages < NUM_PAGES_TO_ALLOC)
- npages = NUM_PAGES_TO_ALLOC;
- }
}
spin_unlock_irqrestore(&pool->lock, irq_flags);