ANDROID: vendor_hooks: vendor hooks for optimizing the blocking problem
caused by rwsem lock contention of reverse mapping during memory recycling. Dear Sir, We want to apply the following five trace hook: 1、trace_android_vh_do_folio_trylock() 2、trace_android_vh_get_folio_trylock_result() 3、trace_android_vh_folio_trylock_clear() 4、trace_android_vh_folio_trylock_set() 5、trace_android_vh_handle_trylock_failed_folio(). The optimization objectives are as follows: In the process of memory recycling,reverse mapping is indispensable. The role of reverse mapping is to find all vma or page tables mapped to this page through physical address or page structure. Therefore,the process of reverse mapping will inevitably bring synchronous operations. Whether it is file page or an anonymous page,the synchronization operation is realized through the rwsem read-write lock. Therefore,when kswapd or the user's key thread enters direct_reclaim,the rwsem lock will cause the entire recycling link to be blocked,resulting in low memory recycling efficiency and affecting the user experience. On Xiaomi mobile phones,there is a situation in which the reverse mapping is stuck in the rwsem read-write lock during the file page recycling process,causing the entire recycling link to be blocked,so that the memory cannot be recycled in time. The display on the trace shows that there are a large number of D states,and its block function is rmap_walk_file,therefore,for non-forced recycling scenarios,try_lock and asynchronous recycling are used to handle related blocked pages. Bug: 383449177 Bug: 353608806 Change-Id: I3973c9ddc4e25f8b20e763a4a8aa2dd327e3139d Signed-off-by:Marcus Ma <maminghui5@xiaomi.corp-partner.google.com> (cherry picked from commit a3bb225a) Signed-off-by:
yipeng xiang <yipengxiang@honor.corp-partner.google.com>
Loading
Please sign in to comment