From owner-svn-src-head@FreeBSD.ORG Thu Dec 19 12:00:48 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 98C8575C; Thu, 19 Dec 2013 12:00:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8506A18A4; Thu, 19 Dec 2013 12:00:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBJC0mG5001225; Thu, 19 Dec 2013 12:00:48 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBJC0mXm001223; Thu, 19 Dec 2013 12:00:48 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201312191200.rBJC0mXm001223@svn.freebsd.org> From: Andriy Gapon Date: Thu, 19 Dec 2013 12:00:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r259612 - head/sys/dev/drm2/ttm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 12:00:48 -0000 Author: avg Date: Thu Dec 19 12:00:48 2013 New Revision: 259612 URL: http://svnweb.freebsd.org/changeset/base/259612 Log: ttm_bo_vm_lookup_rb: actually make use of the red-black tree Previously the code would just iterate over the whole tree as if it were just a list. Without this change I would observe X server becoming more and more jerky over time. MFC after: 5 days Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_bo_vm.c Thu Dec 19 10:28:54 2013 (r259611) +++ head/sys/dev/drm2/ttm/ttm_bo_vm.c Thu Dec 19 12:00:48 2013 (r259612) @@ -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))