From: Cho KyongHo Date: Wed, 7 Feb 2018 05:46:49 +0000 (+0900) Subject: android: ion: do not defer free for carveout heap X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2fd597315e34d48bbdfc9d1ac24d00024a9e80b0;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git android: ion: do not defer free for carveout heap Carved out heaps allocate buffers from a memory pool of with a limited size. If it frees buffers in deferred manner, the heap may not be available in a rare condition by unexpected external fragmentations. Let's think about the following scenario in a 10MB carveout pool: 1. allocated 4MB @ +0MB 2. allocated 2MB @ +4MB 3. freed 1 but defferred 4. freed 2 but defferred 5. allocated 3MB @ +6MB 6. returned buffer 1 and 2 to the heap. 7. allocated 4MB @ +0MB 8. allocation of 3MB failed due to the fragmentation. Any defferred behavior to the very limited resources is harmful. Change-Id: I0a64fdec56f0ec1992c20f8ccd50d5c7fbfa8d40 Signed-off-by: Cho KyongHo --- diff --git a/drivers/staging/android/ion/ion_carveout_heap.c b/drivers/staging/android/ion/ion_carveout_heap.c index fee7650d6fbb..dcee60b2d813 100644 --- a/drivers/staging/android/ion/ion_carveout_heap.c +++ b/drivers/staging/android/ion/ion_carveout_heap.c @@ -141,7 +141,6 @@ struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *heap_data) -1); carveout_heap->heap.ops = &carveout_heap_ops; carveout_heap->heap.type = ION_HEAP_TYPE_CARVEOUT; - carveout_heap->heap.flags = ION_HEAP_FLAG_DEFER_FREE; return &carveout_heap->heap; }