Commit e1b52934 authored by liuyb20's avatar liuyb20 Committed by Treehugger Robot
Browse files

ANDROID: vendor hooks: avoid disable interrupt long time



In Linux 6.6.57 kernel version, there is a problem that disable interrupt too long time
in free swap entry code path.
The longest disable interrupt time more than 100 ms. the code path as follow:
free_swap_slot
   spin_lock_irq(&cache->free_lock)                     // begin disable interrupt
   swapcache_free_entries
        swap_entry_free
            swap_range_free
                 clear_shadow_from_swap_cache
                         xa_unlock_irq                                      // enable interrupt
for each swap slot disable interrupt, try free zram page, uncharge the swap page, find the page
in pagecache and clear page shadow.In this code path, may need hold zwap tree lock, zswap pool
lock, slab lock, pagecache tree lock. In some condition may cost too long time.

log:
irqsoff: Process 13308 detected Process 13308 disable interrupt 115.612552ms from 253626.367842426s
Warning: disable at:
  [<ffffffc080385328>] free_swap_slot+0x70/0x108
  [<ffffffc08109dc68>] _raw_spin_lock_irq+0x24/0x84
  Call trace:
   dump_backtrace+0xec/0x138
   show_stack+0x18/0x28
   dump_stack_lvl+0x60/0x84
   dump_stack+0x18/0x24
   stop_eirqsoff_timing+0x168/0x1e8
   __traceiter_android_rvh_irqs_enable+0x50/0x74
   trace_hardirqs_on+0x1a0/0x1a8
   _raw_spin_unlock_irq+0x18/0x48
   clear_shadow_from_swap_cache+0x74/0x1d0
   swap_range_free+0xe4/0x188
   swapcache_free_entries+0x224/0x290
   free_swap_slot+0x9c/0x108
   free_swap_and_cache_nr+0x180/0x2cc
   unmap_page_range+0x484/0xd40
   unmap_vmas+0xdc/0x148
   exit_mmap+0x108/0x500
   __mmput+0x40/0x170
   mmput+0x30/0xdc
   do_exit+0x2c8/0xa98
   trace_android_vh_do_group_exit+0x0/0x90
   get_signal+0x7b0/0x8c8
   do_notify_resume+0x128/0x800
   el0_svc+0x6c/0x70
   el0t_64_sync_handler+0x68/0xbc
   el0t_64_sync+0x1a8/0x1ac

so we add a vendor hook, the vendor hook walk around swap slot cache,
avoid disable interrupt too long time.

Bug: 405488852
Bug: 402643884
Change-Id: Ia6b657b79414816bdac5362af64b7a356574a39d
Signed-off-by: default avatarliuyb20 <liuyb20@lenovo.com>
(cherry picked from commit 577df909)
parent ed8f6dad
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment