Lines Matching refs:cursor

41 ttm_resource_cursor_clear_bulk(struct ttm_resource_cursor *cursor)  in ttm_resource_cursor_clear_bulk()  argument
43 lockdep_assert_held(&cursor->man->bdev->lru_lock); in ttm_resource_cursor_clear_bulk()
45 cursor->bulk = NULL; in ttm_resource_cursor_clear_bulk()
46 list_del_init(&cursor->bulk_link); in ttm_resource_cursor_clear_bulk()
51 struct ttm_resource_cursor *cursor) in ttm_resource_cursor_move_bulk_tail() argument
55 lockdep_assert_held(&cursor->man->bdev->lru_lock); in ttm_resource_cursor_move_bulk_tail()
57 if (WARN_ON_ONCE(bulk != cursor->bulk)) { in ttm_resource_cursor_move_bulk_tail()
58 list_del_init(&cursor->bulk_link); in ttm_resource_cursor_move_bulk_tail()
62 pos = &bulk->pos[cursor->mem_type][cursor->priority]; in ttm_resource_cursor_move_bulk_tail()
64 list_move(&cursor->hitch.link, &pos->last->lru.link); in ttm_resource_cursor_move_bulk_tail()
65 ttm_resource_cursor_clear_bulk(cursor); in ttm_resource_cursor_move_bulk_tail()
71 struct ttm_resource_cursor *cursor, *next; in ttm_bulk_move_adjust_cursors() local
73 list_for_each_entry_safe(cursor, next, &bulk->cursor_list, bulk_link) in ttm_bulk_move_adjust_cursors()
74 ttm_resource_cursor_move_bulk_tail(bulk, cursor); in ttm_bulk_move_adjust_cursors()
80 struct ttm_resource_cursor *cursor, *next; in ttm_bulk_move_drop_cursors() local
82 list_for_each_entry_safe(cursor, next, &bulk->cursor_list, bulk_link) in ttm_bulk_move_drop_cursors()
83 ttm_resource_cursor_clear_bulk(cursor); in ttm_bulk_move_drop_cursors()
93 void ttm_resource_cursor_init(struct ttm_resource_cursor *cursor, in ttm_resource_cursor_init() argument
96 cursor->priority = 0; in ttm_resource_cursor_init()
97 cursor->man = man; in ttm_resource_cursor_init()
98 ttm_lru_item_init(&cursor->hitch, TTM_LRU_HITCH); in ttm_resource_cursor_init()
99 INIT_LIST_HEAD(&cursor->bulk_link); in ttm_resource_cursor_init()
100 INIT_LIST_HEAD(&cursor->hitch.link); in ttm_resource_cursor_init()
111 void ttm_resource_cursor_fini(struct ttm_resource_cursor *cursor) in ttm_resource_cursor_fini() argument
113 lockdep_assert_held(&cursor->man->bdev->lru_lock); in ttm_resource_cursor_fini()
114 list_del_init(&cursor->hitch.link); in ttm_resource_cursor_fini()
115 ttm_resource_cursor_clear_bulk(cursor); in ttm_resource_cursor_fini()
616 ttm_resource_cursor_check_bulk(struct ttm_resource_cursor *cursor, in ttm_resource_cursor_check_bulk() argument
623 lockdep_assert_held(&cursor->man->bdev->lru_lock); in ttm_resource_cursor_check_bulk()
626 if (cursor->bulk != bulk) { in ttm_resource_cursor_check_bulk()
628 list_move_tail(&cursor->bulk_link, &bulk->cursor_list); in ttm_resource_cursor_check_bulk()
629 cursor->mem_type = next->mem_type; in ttm_resource_cursor_check_bulk()
631 list_del_init(&cursor->bulk_link); in ttm_resource_cursor_check_bulk()
633 cursor->bulk = bulk; in ttm_resource_cursor_check_bulk()
648 ttm_resource_manager_first(struct ttm_resource_cursor *cursor) in ttm_resource_manager_first() argument
650 struct ttm_resource_manager *man = cursor->man; in ttm_resource_manager_first()
657 list_move(&cursor->hitch.link, &man->lru[cursor->priority]); in ttm_resource_manager_first()
658 return ttm_resource_manager_next(cursor); in ttm_resource_manager_first()
669 ttm_resource_manager_next(struct ttm_resource_cursor *cursor) in ttm_resource_manager_next() argument
671 struct ttm_resource_manager *man = cursor->man; in ttm_resource_manager_next()
677 lru = &cursor->hitch; in ttm_resource_manager_next()
678 list_for_each_entry_continue(lru, &man->lru[cursor->priority], link) { in ttm_resource_manager_next()
680 ttm_resource_cursor_check_bulk(cursor, lru); in ttm_resource_manager_next()
681 list_move(&cursor->hitch.link, &lru->link); in ttm_resource_manager_next()
686 if (++cursor->priority >= TTM_MAX_BO_PRIORITY) in ttm_resource_manager_next()
689 list_move(&cursor->hitch.link, &man->lru[cursor->priority]); in ttm_resource_manager_next()
690 ttm_resource_cursor_clear_bulk(cursor); in ttm_resource_manager_next()