Re: [PATCH 01/10] drm/ttm: allocate resource object instead of embedding it v2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Am 03.06.21 um 10:45 schrieb Matthew Auld:
On 02/06/2021 11:09, Christian König wrote:
[SNIP]
-/**
- * ttm_bo_mem_placement - check if placement is compatible
- * @bo: BO to find memory for
- * @place: where to search
- * @mem: the memory object to fill in
- *
- * Check if placement is compatible and fill in mem structure.
- * Returns -EBUSY if placement won't work or negative error code.
- * 0 when placement can be used.
- */
-static int ttm_bo_mem_placement(struct ttm_buffer_object *bo,
-                const struct ttm_place *place,
-                struct ttm_resource *mem)
-{
-    struct ttm_device *bdev = bo->bdev;
-    struct ttm_resource_manager *man;
-
-    man = ttm_manager_type(bdev, place->mem_type);
-    if (!man || !ttm_resource_manager_used(man))
-        return -EBUSY;
-
-    mem->mem_type = place->mem_type;
-    mem->placement = place->flags;
-
-    spin_lock(&bo->bdev->lru_lock);
-    ttm_bo_move_to_lru_tail(bo, mem, NULL);
-    spin_unlock(&bo->bdev->lru_lock);

Why do we drop the move_to_lru_tail here?

Ah, good point.

The move_to_lru_tail() was here to make sure we see the BO in the new LRU instead of the old one before actually doing the move.

Since we haven't allocated the mem structure at this point that is no longer possible, but I think it is ok to do this for now.

One motivation of doing this is to move the LRU handling into the resource backend, so that tricks like those are not needed any more.

Regards,
Christian.



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux