Lines Matching full:cursor
38 /* Detach the cursor from the bulk move list*/
40 ttm_resource_cursor_clear_bulk(struct ttm_resource_cursor *cursor) in ttm_resource_cursor_clear_bulk() argument
42 lockdep_assert_held(&cursor->man->bdev->lru_lock); in ttm_resource_cursor_clear_bulk()
44 cursor->bulk = NULL; in ttm_resource_cursor_clear_bulk()
45 list_del_init(&cursor->bulk_link); in ttm_resource_cursor_clear_bulk()
48 /* Move the cursor to the end of the bulk move list it's in */
50 struct ttm_resource_cursor *cursor) in ttm_resource_cursor_move_bulk_tail() argument
54 lockdep_assert_held(&cursor->man->bdev->lru_lock); in ttm_resource_cursor_move_bulk_tail()
56 if (WARN_ON_ONCE(bulk != cursor->bulk)) { in ttm_resource_cursor_move_bulk_tail()
57 list_del_init(&cursor->bulk_link); in ttm_resource_cursor_move_bulk_tail()
61 pos = &bulk->pos[cursor->mem_type][cursor->priority]; in ttm_resource_cursor_move_bulk_tail()
63 list_move(&cursor->hitch.link, &pos->last->lru.link); in ttm_resource_cursor_move_bulk_tail()
64 ttm_resource_cursor_clear_bulk(cursor); in ttm_resource_cursor_move_bulk_tail()
70 struct ttm_resource_cursor *cursor, *next; in ttm_bulk_move_adjust_cursors() local
72 list_for_each_entry_safe(cursor, next, &bulk->cursor_list, bulk_link) in ttm_bulk_move_adjust_cursors()
73 ttm_resource_cursor_move_bulk_tail(bulk, cursor); in ttm_bulk_move_adjust_cursors()
76 /* Remove a cursor from an empty bulk move list */
79 struct ttm_resource_cursor *cursor, *next; in ttm_bulk_move_drop_cursors() local
81 list_for_each_entry_safe(cursor, next, &bulk->cursor_list, bulk_link) in ttm_bulk_move_drop_cursors()
82 ttm_resource_cursor_clear_bulk(cursor); in ttm_bulk_move_drop_cursors()
86 * ttm_resource_cursor_fini() - Finalize the LRU list cursor usage
87 * @cursor: The struct ttm_resource_cursor to finalize.
89 * The function pulls the LRU list cursor off any lists it was previusly
93 void ttm_resource_cursor_fini(struct ttm_resource_cursor *cursor) in ttm_resource_cursor_fini() argument
95 lockdep_assert_held(&cursor->man->bdev->lru_lock); in ttm_resource_cursor_fini()
96 list_del_init(&cursor->hitch.link); in ttm_resource_cursor_fini()
97 ttm_resource_cursor_clear_bulk(cursor); in ttm_resource_cursor_fini()
206 /* Add the resource to a bulk_move cursor */
591 ttm_resource_cursor_check_bulk(struct ttm_resource_cursor *cursor, in ttm_resource_cursor_check_bulk() argument
598 lockdep_assert_held(&cursor->man->bdev->lru_lock); in ttm_resource_cursor_check_bulk()
601 if (cursor->bulk != bulk) { in ttm_resource_cursor_check_bulk()
603 list_move_tail(&cursor->bulk_link, &bulk->cursor_list); in ttm_resource_cursor_check_bulk()
604 cursor->mem_type = next->mem_type; in ttm_resource_cursor_check_bulk()
606 list_del_init(&cursor->bulk_link); in ttm_resource_cursor_check_bulk()
608 cursor->bulk = bulk; in ttm_resource_cursor_check_bulk()
616 * @cursor: cursor to record the position
618 * Initializes the cursor and starts iterating. When done iterating,
625 struct ttm_resource_cursor *cursor) in ttm_resource_manager_first() argument
629 cursor->priority = 0; in ttm_resource_manager_first()
630 cursor->man = man; in ttm_resource_manager_first()
631 ttm_lru_item_init(&cursor->hitch, TTM_LRU_HITCH); in ttm_resource_manager_first()
632 INIT_LIST_HEAD(&cursor->bulk_link); in ttm_resource_manager_first()
633 list_add(&cursor->hitch.link, &man->lru[cursor->priority]); in ttm_resource_manager_first()
635 return ttm_resource_manager_next(cursor); in ttm_resource_manager_first()
641 * @cursor: cursor to record the position
646 ttm_resource_manager_next(struct ttm_resource_cursor *cursor) in ttm_resource_manager_next() argument
648 struct ttm_resource_manager *man = cursor->man; in ttm_resource_manager_next()
654 lru = &cursor->hitch; in ttm_resource_manager_next()
655 list_for_each_entry_continue(lru, &man->lru[cursor->priority], link) { in ttm_resource_manager_next()
657 ttm_resource_cursor_check_bulk(cursor, lru); in ttm_resource_manager_next()
658 list_move(&cursor->hitch.link, &lru->link); in ttm_resource_manager_next()
663 if (++cursor->priority >= TTM_MAX_BO_PRIORITY) in ttm_resource_manager_next()
666 list_move(&cursor->hitch.link, &man->lru[cursor->priority]); in ttm_resource_manager_next()
667 ttm_resource_cursor_clear_bulk(cursor); in ttm_resource_manager_next()
670 ttm_resource_cursor_fini(cursor); in ttm_resource_manager_next()