Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mm: v2 drain TLB batching against CMA pages
MM has used TLB batching flush for memory unmapping. The batching scheme does memory batch freeing as well as TLB batching flush. Problem with CMA is process could schdule out once it kept holding refcount of pages. CPU 0 CPU 1 do_madvise/munmap/exit_mmap zap_pte_range __tlb_remove_page .. cma_alloc start sched out after 1sec keep failing since sched in .. tlb_flush free_pages_and_swap_cache page_refcount is zero, finally. page migration succeded cma_alloc returns If the process on CPU 0 is lower priority process, the CMA allocation latency depends on the scheduler, sometimes, which is priority inversion if process in CPU is higher priority. This patch tries to fix it via using TLB draining right before scheduling out(to release those pages immediately) if TLB has CMA pages in the batch. CPU 0 CPU 1 do_madvise/munmap/exit_mmap zap_pte_range __tlb_remove_page .. cma_alloc start sched out after 1sec keep failing since sched in .. tlb_flush free_pages_and_swap_cache page_refcount is zero, finally. page migration succeded cma_alloc returns If the process on CPU 0 is lower priority process, the CMA allocation latency depends on the scheduler, sometimes, which is priority inversion if process in CPU is higher priority. This patch tries to fix it via using TLB draining right before scheduling out(to release those pages immediately) if TLB has CMA pages in the batch. Due to vendor hook module load timing, following during boot can happens. CPU A CPU B zap_pte_range .. vendor_module registration .. register_trace_android_vh_zap_pte_range_tlb_start trace_android_vh_zap_pte_range_tlb_start -----> preempt_disable .. trace_android_vh_zap_pte_range_tlb_end -----> none .. register_trace_android_vh_zap_pte_range_tlb_end To prevent it, we need to register register_trace_android_vh_zap_pte_range_tlb_end first rather than register_trace_android_vh_zap_pte_range_tlb_start. Bug: 238728493 Bug: 256549265 Change-Id: I7bdcf4f99f8a6ad79ba4e4bab7510549ad0b88bc Signed-off-by: Minchan Kim <[email protected]>
- Loading branch information