[RFC PATCH 126/162] drm/i915/gem: Update shmem available memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Bommu Krishnaiah <krishnaiah.bommu@xxxxxxxxx>

Update shmem available memory in “intel_memory_region”

Signed-off-by: Bommu Krishnaiah <krishnaiah.bommu@xxxxxxxxx>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@xxxxxxxxx>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@xxxxxxxxx>
Cc: CQ Tang <cq.tang@xxxxxxxxx>
---
 drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
index b4dd7a709800..f4bac72b3ccd 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
@@ -30,6 +30,7 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj)
 	struct drm_i915_private *i915 = to_i915(obj->base.dev);
 	struct intel_memory_region *mem = obj->mm.region;
 	const unsigned long page_count = obj->base.size / PAGE_SIZE;
+	resource_size_t size = obj->base.size;
 	unsigned long i;
 	struct address_space *mapping;
 	struct sg_table *st;
@@ -184,6 +185,8 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj)
 
 	__i915_gem_object_set_pages(obj, st, sg_page_sizes);
 
+	mem->avail -= size;
+
 	return 0;
 
 err_sg:
@@ -298,6 +301,8 @@ __i915_gem_object_release_shmem(struct drm_i915_gem_object *obj,
 
 void i915_gem_object_put_pages_shmem(struct drm_i915_gem_object *obj, struct sg_table *pages)
 {
+	struct intel_memory_region *mem = obj->mm.region;
+	resource_size_t size = obj->base.size;
 	struct sgt_iter sgt_iter;
 	struct pagevec pvec;
 	struct page *page;
@@ -326,6 +331,8 @@ void i915_gem_object_put_pages_shmem(struct drm_i915_gem_object *obj, struct sg_
 		check_release_pagevec(&pvec);
 	obj->mm.dirty = false;
 
+	mem->avail += size;
+
 	sg_free_table(pages);
 	kfree(pages);
 }
-- 
2.26.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux