Since we mandate a strict reverse-order of drm_mm_scan_remove_block() after drm_mm_scan_add_block() we can further simplify the list manipulations when generating the temporary scan-hole. Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/drm_mm.c | 22 +++++----------------- include/drm/drm_mm.h | 7 +------ 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index 7245483f1111..ba1a244fe6e5 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c @@ -518,9 +518,7 @@ void drm_mm_remove_node(struct drm_mm_node *node) struct drm_mm_node *prev_node; DRM_MM_BUG_ON(!node->allocated); - DRM_MM_BUG_ON(node->scanned_block || - node->scanned_prev_free || - node->scanned_next_free); + DRM_MM_BUG_ON(node->scanned_block); prev_node = list_entry(node->node_list.prev, struct drm_mm_node, node_list); @@ -756,8 +754,6 @@ void drm_mm_scan_init_with_range(struct drm_mm_scan *scan, scan->hit_start = 0; scan->hit_end = 0; - - scan->prev_scanned_node = NULL; } EXPORT_SYMBOL(drm_mm_scan_init_with_range); @@ -787,13 +783,8 @@ bool drm_mm_scan_add_block(struct drm_mm_scan *scan, mm->scan_active++; hole = list_prev_entry(node, node_list); - - node->scanned_preceeds_hole = hole->hole_follows; - hole->hole_follows = 1; - list_del(&node->node_list); - node->node_list.prev = &hole->node_list; - node->node_list.next = &scan->prev_scanned_node->node_list; - scan->prev_scanned_node = node; + DRM_MM_BUG_ON(list_next_entry(hole, node_list) != node); + __list_del_entry(&node->node_list); hole_start = __drm_mm_hole_node_start(hole); hole_end = __drm_mm_hole_node_end(hole); @@ -887,8 +878,8 @@ bool drm_mm_scan_remove_block(struct drm_mm_scan *scan, node->mm->scan_active--; prev_node = list_prev_entry(node, node_list); - - prev_node->hole_follows = node->scanned_preceeds_hole; + DRM_MM_BUG_ON(list_next_entry(prev_node, node_list) != + list_next_entry(node, node_list)); list_add(&node->node_list, &prev_node->node_list); return (node->start + node->size > scan->hit_start && @@ -913,9 +904,6 @@ void drm_mm_init(struct drm_mm *mm, u64 start, u64 size) INIT_LIST_HEAD(&mm->head_node.node_list); mm->head_node.allocated = 0; mm->head_node.hole_follows = 1; - mm->head_node.scanned_block = 0; - mm->head_node.scanned_prev_free = 0; - mm->head_node.scanned_next_free = 0; mm->head_node.mm = mm; mm->head_node.start = start + size; mm->head_node.size = start - mm->head_node.start; diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h index 90d607e31301..4ff76d0ab849 100644 --- a/include/drm/drm_mm.h +++ b/include/drm/drm_mm.h @@ -73,11 +73,8 @@ struct drm_mm_node { struct list_head hole_stack; struct rb_node rb; unsigned hole_follows : 1; - unsigned scanned_block : 1; - unsigned scanned_prev_free : 1; - unsigned scanned_next_free : 1; - unsigned scanned_preceeds_hole : 1; unsigned allocated : 1; + bool scanned_block : 1; unsigned long color; u64 start; u64 size; @@ -117,8 +114,6 @@ struct drm_mm_scan { u64 hit_start; u64 hit_end; - struct drm_mm_node *prev_scanned_node; - unsigned long color; unsigned int flags; }; -- 2.11.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx