Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 612bacfc authored by Jordan Crouse's avatar Jordan Crouse
Browse files

msm: kgsl: Remove enhanced memory accounting



Remove some memory accounting that is unsupported in the upstream kernel.
If the feature that used these statistics returns then these can be
easily returned to their rightful places.

Change-Id: Ic0dedbadf56ab28d6610d52ab6e901dc8f9dadff
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent dc9f5d87
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -327,6 +327,12 @@ static void kgsl_destroy_ion(struct kgsl_dma_buf_meta *meta)
}
#endif

static void kgsl_process_sub_stats(struct kgsl_process_private *priv,
	unsigned int type, uint64_t size)
{
	priv->stats[type].cur -= size;
}

void
kgsl_mem_entry_destroy(struct kref *kref)
{
@@ -2599,6 +2605,16 @@ static long _gpuobj_map_dma_buf(struct kgsl_device *device,
}
#endif

static void kgsl_process_add_stats(struct kgsl_process_private *priv,
	unsigned int type, uint64_t size)
{
	priv->stats[type].cur += size;
	if (priv->stats[type].max < priv->stats[type].cur)
		priv->stats[type].max = priv->stats[type].cur;
}



long kgsl_ioctl_gpuobj_import(struct kgsl_device_private *dev_priv,
		unsigned int cmd, void *data)
{
+0 −33
Original line number Diff line number Diff line
@@ -526,39 +526,6 @@ struct kgsl_snapshot_object {

struct kgsl_device *kgsl_get_device(int dev_idx);

static inline void kgsl_process_add_stats(struct kgsl_process_private *priv,
	unsigned int type, uint64_t size)
{
	priv->stats[type].cur += size;
	if (priv->stats[type].max < priv->stats[type].cur)
		priv->stats[type].max = priv->stats[type].cur;
	add_mm_counter(current->mm, MM_UNRECLAIMABLE, (size >> PAGE_SHIFT));
}

static inline void kgsl_process_sub_stats(struct kgsl_process_private *priv,
	unsigned int type, uint64_t size)
{
	struct pid *pid_struct;
	struct task_struct *task;
	struct mm_struct *mm;

	priv->stats[type].cur -= size;
	pid_struct = find_get_pid(priv->pid);
	if (pid_struct) {
		task = get_pid_task(pid_struct, PIDTYPE_PID);
		if (task) {
			mm = get_task_mm(task);
			if (mm) {
				add_mm_counter(mm, MM_UNRECLAIMABLE,
					-(size >> PAGE_SHIFT));
				mmput(mm);
			}
			put_task_struct(task);
		}
		put_pid(pid_struct);
	}
}

static inline bool kgsl_is_register_offset(struct kgsl_device *device,
				unsigned int offsetwords)
{
+0 −5
Original line number Diff line number Diff line
@@ -421,8 +421,6 @@ static int kgsl_pool_alloc_page(int *page_size, struct page **pages,
		pcount++;
	}

	mod_node_page_state(page_pgdat(page), NR_UNRECLAIMABLE_PAGES,
					(1 << order));
	return pcount;

eagain:
@@ -494,9 +492,6 @@ static void kgsl_pool_free_page(struct page *page)

	page_order = compound_order(page);

	mod_node_page_state(page_pgdat(page), NR_UNRECLAIMABLE_PAGES,
					-(1 << page_order));

	if (!kgsl_pool_max_pages ||
			(kgsl_pool_size_total() < kgsl_pool_max_pages)) {
		pool = _kgsl_get_pool_from_order(page_order);
+1 −8
Original line number Diff line number Diff line
@@ -986,9 +986,6 @@ static void kgsl_contiguous_free(struct kgsl_memdesc *memdesc)

	atomic_long_sub(memdesc->size, &kgsl_driver.stats.coherent);

	mod_node_page_state(page_pgdat(phys_to_page(memdesc->physaddr)),
		NR_UNRECLAIMABLE_PAGES, -(memdesc->size >> PAGE_SHIFT));

	_kgsl_contiguous_free(memdesc);
}

@@ -1186,14 +1183,10 @@ static int kgsl_alloc_contiguous(struct kgsl_device *device,
	memdesc->ops = &kgsl_contiguous_ops;
	ret = _kgsl_alloc_contiguous(device->dev->parent, memdesc, size, 0);

	if (!ret) {
	if (!ret)
		KGSL_STATS_ADD(size, &kgsl_driver.stats.coherent,
			&kgsl_driver.stats.coherent_max);

		mod_node_page_state(page_pgdat(phys_to_page(memdesc->physaddr)),
			NR_UNRECLAIMABLE_PAGES, (size >> PAGE_SHIFT));
	}

	return ret;
}