svn commit: r260779 - stable/10/sys/dev/drm2/ttm

Andriy Gapon avg at FreeBSD.org
Thu Jan 16 16:28:20 UTC 2014


Author: avg
Date: Thu Jan 16 16:28:19 2014
New Revision: 260779
URL: http://svnweb.freebsd.org/changeset/base/260779

Log:
  MFC r259612: ttm_bo_vm_lookup_rb: actually make use of the red-black tree

Modified:
  stable/10/sys/dev/drm2/ttm/ttm_bo_vm.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/drm2/ttm/ttm_bo_vm.c
==============================================================================
--- stable/10/sys/dev/drm2/ttm/ttm_bo_vm.c	Thu Jan 16 16:15:56 2014	(r260778)
+++ stable/10/sys/dev/drm2/ttm/ttm_bo_vm.c	Thu Jan 16 16:28:19 2014	(r260779)
@@ -76,13 +76,16 @@ static struct ttm_buffer_object *ttm_bo_
 	struct ttm_buffer_object *bo;
 	struct ttm_buffer_object *best_bo = NULL;
 
-	RB_FOREACH(bo, ttm_bo_device_buffer_objects, &bdev->addr_space_rb) {
+	bo = RB_ROOT(&bdev->addr_space_rb);
+	while (bo != NULL) {
 		cur_offset = bo->vm_node->start;
 		if (page_start >= cur_offset) {
 			best_bo = bo;
 			if (page_start == cur_offset)
 				break;
-		}
+			bo = RB_RIGHT(bo, vm_rb);
+		} else
+			bo = RB_LEFT(bo, vm_rb);
 	}
 
 	if (unlikely(best_bo == NULL))


More information about the svn-src-stable mailing list