@@ -16,6 +16,8 @@
#include <linux/vmalloc.h>
#include "ion.h"
+unsigned long ion_heap_batch;
+
void *ion_heap_map_kernel(struct ion_heap *heap,
struct ion_buffer *buffer)
{
@@ -303,7 +305,15 @@ int ion_heap_init_shrinker(struct ion_heap *heap)
heap->shrinker.count_objects = ion_heap_shrink_count;
heap->shrinker.scan_objects = ion_heap_shrink_scan;
heap->shrinker.seeks = DEFAULT_SEEKS;
- heap->shrinker.batch = 0;
+ heap->shrinker.batch = ion_heap_batch;
return register_shrinker(&heap->shrinker);
}
+
+static int __init ion_system_heap_batch_init(char *arg)
+{
+ ion_heap_batch = memparse(arg, NULL);
+
+ return 0;
+}
+early_param("ion_batch", ion_system_heap_batch_init);
@@ -182,7 +182,7 @@ static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask,
if (!nr_to_scan)
only_scan = 1;
- for (i = 0; i < NUM_ORDERS; i++) {
+ for (i = NUM_ORDERS - 1; i >= 0; i--) {
pool = sys_heap->pools[i];
if (only_scan) {