diff options
-rw-r--r-- | sys/dev/pci/drm/i915/gem/i915_gem_shmem.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/dev/pci/drm/i915/gem/i915_gem_shmem.c b/sys/dev/pci/drm/i915/gem/i915_gem_shmem.c index 3c5182c2dd4..537c92e5242 100644 --- a/sys/dev/pci/drm/i915/gem/i915_gem_shmem.c +++ b/sys/dev/pci/drm/i915/gem/i915_gem_shmem.c @@ -43,7 +43,6 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj) unsigned long last_pfn = 0; /* suppress gcc warning */ unsigned int max_segment = i915_sg_segment_size(); unsigned int sg_page_sizes; - struct pagevec pvec; gfp_t noreclaim; int ret; @@ -225,13 +224,17 @@ err_sg: sg_mark_end(sg); err_pages: mapping_clear_unevictable(mapping); - pagevec_init(&pvec); - for_each_sgt_page(page, sgt_iter, st) { - if (!pagevec_add(&pvec, page)) + if (sg != st->sgl) { + struct pagevec pvec; + + pagevec_init(&pvec); + for_each_sgt_page(page, sgt_iter, st) { + if (!pagevec_add(&pvec, page)) + check_release_pagevec(&pvec); + } + if (pagevec_count(&pvec)) check_release_pagevec(&pvec); } - if (pagevec_count(&pvec)) - check_release_pagevec(&pvec); #else err_pages: uvm_objunwire(obj->base.uao, 0, obj->base.size); |