mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 21:33:00 +00:00
drm/ttm: add page order support in ttm_pages_put
Reviewed-by: Chunming Zhou <david1.zhou@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Roger He <Hongbo.He@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
54ddc5f2d7
commit
bae5c5b50b
@ -296,13 +296,23 @@ static struct ttm_page_pool *ttm_get_pool(int flags, bool huge,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* set memory back to wb and free the pages. */
|
/* set memory back to wb and free the pages. */
|
||||||
static void ttm_pages_put(struct page *pages[], unsigned npages)
|
static void ttm_pages_put(struct page *pages[], unsigned npages,
|
||||||
|
unsigned int order)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned int i, pages_nr = (1 << order);
|
||||||
if (set_pages_array_wb(pages, npages))
|
|
||||||
pr_err("Failed to set %d pages to wb!\n", npages);
|
if (order == 0) {
|
||||||
for (i = 0; i < npages; ++i)
|
if (set_pages_array_wb(pages, npages))
|
||||||
__free_page(pages[i]);
|
pr_err("Failed to set %d pages to wb!\n", npages);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < npages; ++i) {
|
||||||
|
if (order > 0) {
|
||||||
|
if (set_pages_wb(pages[i], pages_nr))
|
||||||
|
pr_err("Failed to set %d pages to wb!\n", pages_nr);
|
||||||
|
}
|
||||||
|
__free_pages(pages[i], order);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ttm_pool_update_free_locked(struct ttm_page_pool *pool,
|
static void ttm_pool_update_free_locked(struct ttm_page_pool *pool,
|
||||||
@ -365,7 +375,7 @@ restart:
|
|||||||
*/
|
*/
|
||||||
spin_unlock_irqrestore(&pool->lock, irq_flags);
|
spin_unlock_irqrestore(&pool->lock, irq_flags);
|
||||||
|
|
||||||
ttm_pages_put(pages_to_free, freed_pages);
|
ttm_pages_put(pages_to_free, freed_pages, pool->order);
|
||||||
if (likely(nr_free != FREE_ALL_PAGES))
|
if (likely(nr_free != FREE_ALL_PAGES))
|
||||||
nr_free -= freed_pages;
|
nr_free -= freed_pages;
|
||||||
|
|
||||||
@ -400,7 +410,7 @@ restart:
|
|||||||
spin_unlock_irqrestore(&pool->lock, irq_flags);
|
spin_unlock_irqrestore(&pool->lock, irq_flags);
|
||||||
|
|
||||||
if (freed_pages)
|
if (freed_pages)
|
||||||
ttm_pages_put(pages_to_free, freed_pages);
|
ttm_pages_put(pages_to_free, freed_pages, pool->order);
|
||||||
out:
|
out:
|
||||||
if (pages_to_free != static_buf)
|
if (pages_to_free != static_buf)
|
||||||
kfree(pages_to_free);
|
kfree(pages_to_free);
|
||||||
|
Loading…
Reference in New Issue
Block a user