This repository has been archived by the owner on Jul 7, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ion: Rewrite for improved clarity and performance
The ION driver suffers from massive code bloat caused by excessive debug features, as well as poor lock usage as a result of that. Multiple locks in ION exist to make the debug features thread-safe, which hurts ION's actual performance when doing its job. There are numerous code paths in ION that hold mutexes for no reason and hold them for longer than necessary. This results in not only unwanted lock contention, but also long delays when a mutex lock results in the calling thread getting preempted for a while. All lock usage in ION follows this pattern, which causes poor performance across the board. Furthermore, a single big lock is used mostly everywhere rather than multiple fine-grained locks. Most of the mutex locks can be replaced with simple atomic operations. Where a mutex lock can't be eliminated completely, a spinlock or rwlock can be used instead for quick operations, thereby avoiding long delays due to preemption. Fine-grained locks are also now used in place of the single big lock that was used before. Additionally, ion_dupe_sg_table is called very frequently, and lies within the rendering path for the display. Speed it up by reserving caches for its sg_table and page-sized scatterlist allocations, as well as by improving the sg copy process. Note that sg_alloc_table zeroes out `table`, so there's no need to zero it out using the memory allocator. Overall, just rewrite ION entirely to fix its deficiencies. This optimizes ION for excellent performance and discards its rarely-used debug bloat. Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com> Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
- Loading branch information