diff options
author | attilio <attilio@FreeBSD.org> | 2013-08-09 11:28:55 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2013-08-09 11:28:55 +0000 |
commit | e9f37cac7422f86c8a65b4c123705f5dccd43fa1 (patch) | |
tree | 589f2433c8a0e985a4f0aeb058fbbf1b412b6f98 /sys/dev | |
parent | 3f74b0e634cf4f4b3796e44533e8318ef773c3e9 (diff) | |
download | FreeBSD-src-e9f37cac7422f86c8a65b4c123705f5dccd43fa1.zip FreeBSD-src-e9f37cac7422f86c8a65b4c123705f5dccd43fa1.tar.gz |
On all the architectures, avoid to preallocate the physical memory
for nodes used in vm_radix.
On architectures supporting direct mapping, also avoid to pre-allocate
the KVA for such nodes.
In order to do so make the operations derived from vm_radix_insert()
to fail and handle all the deriving failure of those.
vm_radix-wise introduce a new function called vm_radix_replace(),
which can replace a leaf node, already present, with a new one,
and take into account the possibility, during vm_radix_insert()
allocation, that the operations on the radix trie can recurse.
This means that if operations in vm_radix_insert() recursed
vm_radix_insert() will start from scratch again.
Sponsored by: EMC / Isilon storage division
Reviewed by: alc (older version)
Reviewed by: jeff
Tested by: pho, scottl
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/drm2/i915/i915_gem.c | 11 | ||||
-rw-r--r-- | sys/dev/drm2/ttm/ttm_bo_vm.c | 14 |
2 files changed, 21 insertions, 4 deletions
diff --git a/sys/dev/drm2/i915/i915_gem.c b/sys/dev/drm2/i915/i915_gem.c index a4276a2..b2edf1a 100644 --- a/sys/dev/drm2/i915/i915_gem.c +++ b/sys/dev/drm2/i915/i915_gem.c @@ -64,6 +64,9 @@ __FBSDID("$FreeBSD$"); #include <sys/sched.h> #include <sys/sf_buf.h> +#include <vm/vm.h> +#include <vm/vm_pageout.h> + static void i915_gem_object_flush_cpu_write_domain( struct drm_i915_gem_object *obj); static uint32_t i915_gem_get_gtt_size(struct drm_device *dev, uint32_t size, @@ -1443,8 +1446,14 @@ retry: vm_page_busy_sleep(m, "915pbs"); goto retry; } + if (vm_page_insert(m, vm_obj, OFF_TO_IDX(offset))) { + DRM_UNLOCK(dev); + VM_OBJECT_WUNLOCK(vm_obj); + VM_WAIT; + VM_OBJECT_WLOCK(vm_obj); + goto retry; + } m->valid = VM_PAGE_BITS_ALL; - vm_page_insert(m, vm_obj, OFF_TO_IDX(offset)); have_page: *mres = m; vm_page_xbusy(m); diff --git a/sys/dev/drm2/ttm/ttm_bo_vm.c b/sys/dev/drm2/ttm/ttm_bo_vm.c index 0faf868..366a776 100644 --- a/sys/dev/drm2/ttm/ttm_bo_vm.c +++ b/sys/dev/drm2/ttm/ttm_bo_vm.c @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include <vm/vm.h> #include <vm/vm_page.h> +#include <vm/vm_pageout.h> #define TTM_BO_VM_NUM_PREFAULT 16 @@ -221,16 +222,23 @@ reserve: ttm_bo_unreserve(bo); goto retry; } - m->valid = VM_PAGE_BITS_ALL; - *mres = m; m1 = vm_page_lookup(vm_obj, OFF_TO_IDX(offset)); if (m1 == NULL) { - vm_page_insert(m, vm_obj, OFF_TO_IDX(offset)); + if (vm_page_insert(m, vm_obj, OFF_TO_IDX(offset))) { + VM_OBJECT_WUNLOCK(vm_obj); + VM_WAIT; + VM_OBJECT_WLOCK(vm_obj); + ttm_mem_io_unlock(man); + ttm_bo_unreserve(bo); + goto retry; + } } else { KASSERT(m == m1, ("inconsistent insert bo %p m %p m1 %p offset %jx", bo, m, m1, (uintmax_t)offset)); } + m->valid = VM_PAGE_BITS_ALL; + *mres = m; vm_page_xbusy(m); if (oldm != NULL) { |