Lines Matching refs:npages
77 unsigned npages; member
276 static void ttm_pages_put(struct page *pages[], unsigned npages) in ttm_pages_put() argument
279 if (set_pages_array_wb(pages, npages)) in ttm_pages_put()
280 pr_err("Failed to set %d pages to wb!\n", npages); in ttm_pages_put()
281 for (i = 0; i < npages; ++i) in ttm_pages_put()
288 pool->npages -= freed_pages; in ttm_pool_update_free_locked()
430 count += _manager->pools[i].npages; in ttm_pool_shrink_count()
593 && count > pool->npages) { in ttm_page_pool_fill_locked()
611 pool->npages += alloc_size; in ttm_page_pool_fill_locked()
619 pool->npages += cpages; in ttm_page_pool_fill_locked()
644 if (count >= pool->npages) { in ttm_page_pool_get_pages()
647 count -= pool->npages; in ttm_page_pool_get_pages()
648 pool->npages = 0; in ttm_page_pool_get_pages()
653 if (count <= pool->npages/2) { in ttm_page_pool_get_pages()
660 i = pool->npages + 1; in ttm_page_pool_get_pages()
668 pool->npages -= count; in ttm_page_pool_get_pages()
676 static void ttm_put_pages(struct page **pages, unsigned npages, int flags, in ttm_put_pages() argument
685 for (i = 0; i < npages; i++) { in ttm_put_pages()
697 for (i = 0; i < npages; i++) { in ttm_put_pages()
703 pool->npages++; in ttm_put_pages()
707 npages = 0; in ttm_put_pages()
708 if (pool->npages > _manager->options.max_size) { in ttm_put_pages()
709 npages = pool->npages - _manager->options.max_size; in ttm_put_pages()
712 if (npages < NUM_PAGES_TO_ALLOC) in ttm_put_pages()
713 npages = NUM_PAGES_TO_ALLOC; in ttm_put_pages()
716 if (npages) in ttm_put_pages()
717 ttm_page_pool_free(pool, npages, false); in ttm_put_pages()
724 static int ttm_get_pages(struct page **pages, unsigned npages, int flags, in ttm_get_pages() argument
745 for (r = 0; r < npages; ++r) { in ttm_get_pages()
763 npages = ttm_page_pool_get_pages(pool, &plist, flags, cstate, npages); in ttm_get_pages()
780 if (npages > 0) { in ttm_get_pages()
785 r = ttm_alloc_new_pages(&plist, gfp_flags, flags, cstate, npages); in ttm_get_pages()
807 pool->npages = pool->nfrees = 0; in ttm_page_pool_init_locked()
938 p->nfrees, p->npages); in ttm_page_alloc_debugfs()