Upstream Support for ION
Features missing upstream needed by ION
As part of Linaro's effort to get Android to use as much upstream kernel features as possible, an assessment of Android's memory allocator ION was done. We realized that the biggest features missing from upstream Linux kernel hat Android needs are:
- Device memory access constraint sharing mechanism
- Centralized allocation policy or helpers based on device constraints
Device memory access constraint sharing
The present upstream kernel lacks a mechanism to share device constraints related to memory access. At the moment, it is not possible for different devices to advertise their ability / inability to access certain memory regions or types.
This forces user-space to allocate the memory from the subsystem managing the device with the most stringent constraints on memory access.
For user spaces like Android that run on a variety of platforms having devices with different constraints, this makes things quite messy.
Centralized allocation based on device constraints
Even when there is some constraint sharing mechanism in place, different subsystems have to replicate the logic to understand the constraints and allocate accordingly.
This could again contribute to a complicated userspace, and duplicity in the kernel code as well.
For constraint sharing, instead of trying to enumerate generic constraints, we would instead prototype a system which has:
- a list of allocation-functions (presumably populated at platform initialization), and
- a bit-masked constraints field which devices could set according to the regions they can access.
With this information available, for each dma-buf that's going to be accessed by a set of devices, we could mask the constraints at each 'attach' operation by the devices. Then, at first allocation, the exporter could look at this masked constraint field, and select the appropriate allocator from the list of allocation-functions.
For initial constraint sharing prototype, the exporter could just choose the first common allocator function.
Next step would be to create a set of central allocation helpers, which could allow for customization of 'appropriate allocator selection' based on plaftorm.
WorkingGroups/Middleware/Graphics/UMM/Docs/upstream-support-for-ION (last modified 2014-01-23 08:16:01)