Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 282734
b: refs/heads/master
c: 2c05114
h: refs/heads/master
v: v3
  • Loading branch information
Konrad Rzeszutek Wilk authored and Dave Airlie committed Jan 6, 2012
1 parent 70e3d43 commit cecddcc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 36d7c537c3082a492ff851fb0da40ae3d7c5565d
refs/heads/master: 2c05114d23c4fd2256eaf5645528c19fcefdb2c8
15 changes: 10 additions & 5 deletions trunk/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)
struct dma_page *d_page, *next;
enum pool_type type;
bool is_cached = false;
unsigned count = 0, i;
unsigned count = 0, i, npages = 0;
unsigned long irq_flags;

type = ttm_to_type(ttm->page_flags, ttm->caching_state);
Expand All @@ -974,8 +974,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) {
count = pool->npages_free - _manager->options.max_size;
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);
Expand All @@ -999,9 +1004,9 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)
ttm_dma->dma_address[i] = 0;
}

/* shrink pool if necessary */
if (count)
ttm_dma_page_pool_free(pool, count);
/* shrink pool if necessary (only on !is_cached pools)*/
if (npages)
ttm_dma_page_pool_free(pool, npages);
ttm->state = tt_unpopulated;
}
EXPORT_SYMBOL_GPL(ttm_dma_unpopulate);
Expand Down

0 comments on commit cecddcc

Please sign in to comment.