# core library code
 i915-y += \
+       dma_resv_utils.o \
        i915_memcpy.o \
        i915_mm.o \
        i915_sw_fence.o \
 
--- /dev/null
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2020 Intel Corporation
+ */
+
+#include <linux/dma-resv.h>
+
+#include "dma_resv_utils.h"
+
+void dma_resv_prune(struct dma_resv *resv)
+{
+       if (dma_resv_trylock(resv)) {
+               if (dma_resv_test_signaled_rcu(resv, true))
+                       dma_resv_add_excl_fence(resv, NULL);
+               dma_resv_unlock(resv);
+       }
+}
 
--- /dev/null
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2020 Intel Corporation
+ */
+
+#ifndef DMA_RESV_UTILS_H
+#define DMA_RESV_UTILS_H
+
+struct dma_resv;
+
+void dma_resv_prune(struct dma_resv *resv);
+
+#endif /* DMA_RESV_UTILS_H */
 
 
 #include "gt/intel_gt_requests.h"
 
+#include "dma_resv_utils.h"
 #include "i915_trace.h"
 
 static bool swap_available(void)
                                mutex_unlock(&obj->mm.lock);
                        }
 
+                       dma_resv_prune(obj->base.resv);
+
                        scanned += obj->base.size >> PAGE_SHIFT;
                        i915_gem_object_put(obj);
 
 
 
 #include "gt/intel_engine.h"
 
+#include "dma_resv_utils.h"
 #include "i915_gem_ioctls.h"
 #include "i915_gem_object.h"
 
         * Opportunistically prune the fences iff we know they have *all* been
         * signaled.
         */
-       if (prune_fences && dma_resv_trylock(resv)) {
-               if (dma_resv_test_signaled_rcu(resv, true))
-                       dma_resv_add_excl_fence(resv, NULL);
-               dma_resv_unlock(resv);
-       }
+       if (prune_fences)
+               dma_resv_prune(resv);
 
        return timeout;
 }