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

Commit e2f402f3 authored by Vijayanand Jitta's avatar Vijayanand Jitta
Browse files

staging: android: ion: Make ion defer free more aggressive



Heaps such as system heap use defer free where buffers are placed on
a free list and freed by a low priority background thread.This method
doesn't work very well when buffer allocation rate is high, in this case
the new allocations go to buddy instead of using pool of system heap
there by under utilising the pool.

Add support in Ion, via CONFIG_ION_DEFER_FREE_NO_SCHED_IDLE, this config
removes the low priority setting for defer free by removing the SCHED_IDLE
flag as a result we can get more pool allocations

Change-Id: I0e18e08b0d916e1d8822f38178f5ee39f07d6ca6
Signed-off-by: default avatarVijayanand Jitta <vjitta@codeaurora.org>
parent 24811cd3
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -55,3 +55,11 @@ config ION_FORCE_DMA_SYNC
	  We generally don't want to enable this config as it breaks the
	  We generally don't want to enable this config as it breaks the
	  cache maintenance model.
	  cache maintenance model.
	  If you're not sure say N here.
	  If you're not sure say N here.

config ION_DEFER_FREE_NO_SCHED_IDLE
	bool "Increases the priority of ION defer free thead"
	depends on ION
	help
	  Choose this option to remove the SCHED_IDLE flag in case of defer free
	  thereby increasing the priority of defer free thread.
	  if you're not sure say Y here.
+4 −1
Original line number Original line Diff line number Diff line
@@ -250,8 +250,9 @@ static int ion_heap_deferred_free(void *data)


int ion_heap_init_deferred_free(struct ion_heap *heap)
int ion_heap_init_deferred_free(struct ion_heap *heap)
{
{
#ifndef CONFIG_ION_DEFER_FREE_NO_SCHED_IDLE
	struct sched_param param = { .sched_priority = 0 };
	struct sched_param param = { .sched_priority = 0 };

#endif
	INIT_LIST_HEAD(&heap->free_list);
	INIT_LIST_HEAD(&heap->free_list);
	init_waitqueue_head(&heap->waitqueue);
	init_waitqueue_head(&heap->waitqueue);
	heap->task = kthread_run(ion_heap_deferred_free, heap,
	heap->task = kthread_run(ion_heap_deferred_free, heap,
@@ -261,7 +262,9 @@ int ion_heap_init_deferred_free(struct ion_heap *heap)
		       __func__);
		       __func__);
		return PTR_ERR_OR_ZERO(heap->task);
		return PTR_ERR_OR_ZERO(heap->task);
	}
	}
#ifndef CONFIG_ION_DEFER_FREE_NO_SCHED_IDLE
	sched_setscheduler(heap->task, SCHED_IDLE, &param);
	sched_setscheduler(heap->task, SCHED_IDLE, &param);
#endif
	return 0;
	return 0;
}
}