Lines Matching full:cursor

36 /* Detach the cursor from the bulk move list*/
38 ttm_resource_cursor_clear_bulk(struct ttm_resource_cursor *cursor) in ttm_resource_cursor_clear_bulk() argument
40 lockdep_assert_held(&cursor->man->bdev->lru_lock); in ttm_resource_cursor_clear_bulk()
42 cursor->bulk = NULL; in ttm_resource_cursor_clear_bulk()
43 list_del_init(&cursor->bulk_link); in ttm_resource_cursor_clear_bulk()
46 /* Move the cursor to the end of the bulk move list it's in */
48 struct ttm_resource_cursor *cursor) in ttm_resource_cursor_move_bulk_tail() argument
52 lockdep_assert_held(&cursor->man->bdev->lru_lock); in ttm_resource_cursor_move_bulk_tail()
54 if (WARN_ON_ONCE(bulk != cursor->bulk)) { in ttm_resource_cursor_move_bulk_tail()
55 list_del_init(&cursor->bulk_link); in ttm_resource_cursor_move_bulk_tail()
59 pos = &bulk->pos[cursor->mem_type][cursor->priority]; in ttm_resource_cursor_move_bulk_tail()
61 list_move(&cursor->hitch.link, &pos->last->lru.link); in ttm_resource_cursor_move_bulk_tail()
62 ttm_resource_cursor_clear_bulk(cursor); in ttm_resource_cursor_move_bulk_tail()
68 struct ttm_resource_cursor *cursor, *next; in ttm_bulk_move_adjust_cursors() local
70 list_for_each_entry_safe(cursor, next, &bulk->cursor_list, bulk_link) in ttm_bulk_move_adjust_cursors()
71 ttm_resource_cursor_move_bulk_tail(bulk, cursor); in ttm_bulk_move_adjust_cursors()
74 /* Remove a cursor from an empty bulk move list */
77 struct ttm_resource_cursor *cursor, *next; in ttm_bulk_move_drop_cursors() local
79 list_for_each_entry_safe(cursor, next, &bulk->cursor_list, bulk_link) in ttm_bulk_move_drop_cursors()
80 ttm_resource_cursor_clear_bulk(cursor); in ttm_bulk_move_drop_cursors()
84 * ttm_resource_cursor_fini() - Finalize the LRU list cursor usage
85 * @cursor: The struct ttm_resource_cursor to finalize.
87 * The function pulls the LRU list cursor off any lists it was previusly
91 void ttm_resource_cursor_fini(struct ttm_resource_cursor *cursor) in ttm_resource_cursor_fini() argument
93 lockdep_assert_held(&cursor->man->bdev->lru_lock); in ttm_resource_cursor_fini()
94 list_del_init(&cursor->hitch.link); in ttm_resource_cursor_fini()
95 ttm_resource_cursor_clear_bulk(cursor); in ttm_resource_cursor_fini()
204 /* Add the resource to a bulk_move cursor */
556 ttm_resource_cursor_check_bulk(struct ttm_resource_cursor *cursor, in ttm_resource_cursor_check_bulk() argument
563 lockdep_assert_held(&cursor->man->bdev->lru_lock); in ttm_resource_cursor_check_bulk()
566 if (cursor->bulk != bulk) { in ttm_resource_cursor_check_bulk()
568 list_move_tail(&cursor->bulk_link, &bulk->cursor_list); in ttm_resource_cursor_check_bulk()
569 cursor->mem_type = next->mem_type; in ttm_resource_cursor_check_bulk()
571 list_del_init(&cursor->bulk_link); in ttm_resource_cursor_check_bulk()
573 cursor->bulk = bulk; in ttm_resource_cursor_check_bulk()
581 * @cursor: cursor to record the position
583 * Initializes the cursor and starts iterating. When done iterating,
590 struct ttm_resource_cursor *cursor) in ttm_resource_manager_first() argument
594 cursor->priority = 0; in ttm_resource_manager_first()
595 cursor->man = man; in ttm_resource_manager_first()
596 ttm_lru_item_init(&cursor->hitch, TTM_LRU_HITCH); in ttm_resource_manager_first()
597 INIT_LIST_HEAD(&cursor->bulk_link); in ttm_resource_manager_first()
598 list_add(&cursor->hitch.link, &man->lru[cursor->priority]); in ttm_resource_manager_first()
600 return ttm_resource_manager_next(cursor); in ttm_resource_manager_first()
606 * @cursor: cursor to record the position
611 ttm_resource_manager_next(struct ttm_resource_cursor *cursor) in ttm_resource_manager_next() argument
613 struct ttm_resource_manager *man = cursor->man; in ttm_resource_manager_next()
619 lru = &cursor->hitch; in ttm_resource_manager_next()
620 list_for_each_entry_continue(lru, &man->lru[cursor->priority], link) { in ttm_resource_manager_next()
622 ttm_resource_cursor_check_bulk(cursor, lru); in ttm_resource_manager_next()
623 list_move(&cursor->hitch.link, &lru->link); in ttm_resource_manager_next()
628 if (++cursor->priority >= TTM_MAX_BO_PRIORITY) in ttm_resource_manager_next()
631 list_move(&cursor->hitch.link, &man->lru[cursor->priority]); in ttm_resource_manager_next()
632 ttm_resource_cursor_clear_bulk(cursor); in ttm_resource_manager_next()
635 ttm_resource_cursor_fini(cursor); in ttm_resource_manager_next()