Commit Graph

294 Commits

Author SHA1 Message Date
Suren Baghdasaryan
c9ca12bfd2 ANDROID: introduce a vendor hook to allow speculative swap pagefaults
Since SPF is an out-of-tree feature, the risks of changing its behavior
are higher. Add a vendor hook to enable speculative swap pagefaults. By
default it's disabled and should not cause troubles for current users.

Bug: 322762567
Change-Id: I3df7c545aa27d2707ee51ea42368f785c5faa735
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2024-02-08 14:28:49 -08:00
liwei
0a9731879a ANDROID: mm: Add vendor hooks for recording when kswapd finishing the reclaim job
To monitor the reclaiming ability of kswapd, add vendor hook recording when the kswapd finish the reclaiming job and the reclaim progress.

android_vh_vmscan_kswpad_done(int, unsigned int, unsigned int, unsigned int)

Bug: 301044280

Change-Id: Id6e0a97003f0a156cff4d0996bc38bcd89b1dc69
Signed-off-by: John Hsu <john.hsu@mediatek.com>
Signed-off-by: liwei <liwei1234@oppo.com>
(cherry picked from commit 6c3dd25d2fdeff6fc752ef74e87e22f86ae1d939)
2024-02-02 17:56:46 +00:00
liwei
46469e117f ANDROID: vendor_hooks: Add hooks for adjusting alloc_flags
In some situations, we want to adjust the alloc_flags for better performance.

more detail explain:
the reason why we add a vendor hook adjusting alloc_flags:
1 the user only pass parameter size and gfp_flags once. if we mask the
__GFP_RECLAIM, we can't distinguish high-order and low-order, they all
will not rise reclaim behavior, it's wrong.

2 for __iommu_dma_alloc_pages, there is a loop to try to alloc pages from
high-order to low-order fallback, and we add hook callsite to only change
the high-order( > costly order) alloc behavior(which high probability will
result more overhead than benifit).
which allow low order alloc to do reclaim behavior still, otherwise may
end up with alloc fail.

3 in android ION(drivers/dma-buf/heaps/system_heap.c )
there is same logic, high-order alloc will not do reclaim behavior.

so this change add a vendor hook for adjusting alloc_flags, and add a
callsite in __iommu_dma_alloc_pages to turn the reclaim behavior.

Bug: 300857012
Change-Id: I30bd634d8ede1cc29c83d52bdd9276c8cf72ac1e
Signed-off-by: lvwenhuan <lvwenhuan@oppo.com>
Signed-off-by: liwei <liwei1234@oppo.com>
(cherry picked from commit d6c24c3a63567676de818011403abe5b9b3d38b0)
2024-02-02 17:56:02 +00:00
Browse Zhang
85d8fb9163 ANDROID: Add vendor hook for ufs perf heuristic and error recovery
Added vendor hook to consider ufs host/device perf heuristic
and error recovery according to different platform/design
Vendor/Platform can take necessary action according to their
design/implementation

Added vendor hook before calling UFS command ops
   - trace_android_vh_ufs_perf_huristic_ctrl
Added vendor hook after sending UFS command to host
   - trace_android_vh_ufs_send_command_post_change
Added vendor hook for abort success case
   - trace_android_vh_ufs_abort_success_ctrl

Added vendor hook for completion response check
 - trace_android_vh_ufs_compl_rsp_check_done
Added vendor hook for vendor specific error handling
 - trace_android_vh_ufs_err_handler
Added vendor hook for err logs printing control
 - trace_android_vh_ufs_err_print_ctrl
Added vendor hook for error checking flow trigger
 - trace_android_vh_ufs_err_check_ctrl

Bug: 312806167
Change-Id: I2190afe62b60da9d47001307f858f10fc8a59986
Signed-off-by: Sanjeev Yadav <sanjeev.y@mediatek.com>
Signed-off-by: Browse Zhang <browse.zhang@mediatek.com>
2023-12-12 22:03:30 +00:00
lfc
464ef3ee59 ANDROID: vendor_hooks: Add hooks for binder
Add hooks to support oem's binder feature of improving binder_thread->task sched priority

1) Check if it is a specific task in trace_android_vh_alloc_oem_binder_struct() and store the flag to t->android_vendor_data1
2) If it is a specific binder task and binder_thread selected, raise the sched priority of binder_thread->task in runqueue.
3) If it is a specific binder task but no binder_thread selected (e.g pending_async or no free threads), insert t->work to the appropriate position in the list.
4) Reset the sched priority when BR_TRANSACTION or BC_FREE_BUFFER.
Some high-priority async binder task reset the sched priority when BC_FREE_BUFFER in trace_android_vh_binder_free_buf().
Some middle-priority async binder task reset the sched priority when driver return server "BR_TRANSACTION" in trace_android_vh_binder_transaction_received().

Bug: 308391339

Change-Id: Iab4939fe4a4881b31961aaa2fef500b51c944743
Signed-off-by: lfc <lfc@oppo.com>
2023-11-21 02:40:33 +00:00
zihan ju
91d2427218 ANDROID: Add Interrupt Hook for madvise Compression
We introduce an interrupt hook in Android to manage memory compression
using madvise, improving user experience.

Currently, when a user returns to the home screen, memory compression is
triggered using madvise. The vma and PAGEOUT flag are sent to
process_madvise, initiating page reclaim.

However, if an app is re-opened soon after starting compression, the
reclaim process can cause read delays, leading to potential lag.

To resolve this, we propose to skip pte range traversal. By comparing
the vma's task uid with the current app's uid, we can identify and
interrupt the madvise operation for that vma.

Implementing this requires a vendor hook for should_end_madvise. This
allows us to skip traversal, enhancing user experience.

Bug: 307846869

Change-Id: If2bdbc200b7305e92f836353b7356aa115e00705
Signed-off-by: zihan ju <zihan.ju@transsion.com>
2023-11-01 19:07:41 +00:00
xieliujie
d3961f624b ANDROID: vendor_hooks: Add hooks for oem percpu-rwsem optimaton
Recently we have discovered many lag issues caused by percpu_rwsem
lock-holding tasks not being scheduled for a long time. we need to
identify them and provide appropriate scheduling protection in our
oem scheduler.
To support this, we add one hook below:
    trace_android_vh_percpu_rwsem_wq_add

Bug: 301066838
Change-Id: Id770c1a7978842abfc62d3fa9aeb5ac7a1904972
Signed-off-by: xieliujie <xieliujie@oppo.com>
(cherry picked from commit f451f4a59950135ea9a6ede218c58f10dbb3abaa)
2023-09-27 09:11:18 +08:00
Xiaojun Ji
3718ea1e77 ANDROID: vendor_hook: Add hook to skip swapcache
We want to skip swapcache in some scenarios to reduce
swap cache

Bug: 300857016
Change-Id: I8cbc45733d861be6f56628b40a1ef936cae3b45d
Signed-off-by: Xiaojun Ji <jixj@motorola.com>
2023-09-18 15:46:03 +08:00
Lincheng Yang
6356ed35b9 ANDROID: add vendor hook of add/delete/iterate node for swap_avail_heads
Our Android phones occur Panic as follows:

[77522.303024][ T9734] Call trace:
[77522.303039][ T9734] dump_backtrace.cfi_jt+0x0/0x8
[77522.303052][ T9734] dump_stack_lvl+0xc4/0x140
[77522.303061][ T9734] dump_stack+0x1c/0x2c
[77522.303123][ T9734] mrdump_common_die+0x3a8/0x544 [mrdump]
[77522.303177][ T9734] ipanic_die+0x24/0x38 [mrdump]
[77522.303189][ T9734] die+0x340/0x698
[77522.303199][ T9734] bug_handler+0x48/0x108
[77522.303210][ T9734] brk_handler+0xac/0x1a8
[77522.303221][ T9734] do_debug_exception+0xe0/0x1e0
[77522.303233][ T9734] el1_dbg+0x38/0x54
[77522.303242][ T9734] el1_sync_handler+0x40/0x88
[77522.303255][ T9734] el1_sync+0x8c/0x140
[77522.303264][ T9734] plist_requeue+0xd4/0x110
[77522.303297][ T9734] tran_get_swap_pages+0xc8/0x364 [memfusion]
[77522.303329][ T9734] probe_android_vh_get_swap_page+0x1b4/0x220 [memfusion]
[77522.303342][ T9734] get_swap_page+0x258/0x304
[77522.303352][ T9734] shrink_page_list+0xe00/0x1e0c
[77522.303361][ T9734] shrink_inactive_list+0x2f4/0xac8
[77522.303373][ T9734] shrink_lruvec+0x1a4/0x34c
[77522.303383][ T9734] shrink_node_memcgs+0x84/0x3b0
[77522.303391][ T9734] shrink_node+0x2c4/0x6e4
[77522.303400][ T9734] shrink_zones+0x16c/0x29c
[77522.303410][ T9734] do_try_to_free_pages+0xe4/0x2bc
[77522.303418][ T9734] try_to_free_pages+0x388/0x7b4
[77522.303429][ T9734] __alloc_pages_direct_reclaim+0x88/0x278
[77522.303438][ T9734] __alloc_pages_slowpath+0x464/0xb24
[77522.303447][ T9734] __alloc_pages_nodemask+0x1f4/0x3dc
[77522.303458][ T9734] do_anonymous_page+0x164/0x914
[77522.303466][ T9734] handle_pte_fault+0x15c/0x9f8
[77522.303476][ T9734] ___handle_speculative_fault+0x234/0xe18
[77522.303485][ T9734] __handle_speculative_fault+0x78/0x21c
[77522.303497][ T9734] do_page_fault+0x36c/0x754
[77522.303506][ T9734] do_translation_fault+0x48/0x64
[77522.303514][ T9734] do_mem_abort+0x6c/0x164
[77522.303522][ T9734] el0_da+0x24/0x34
[77522.303531][ T9734] el0_sync_handler+0xc8/0xf0
[77522.303539][ T9734] el0_sync+0x1b4/0x1c0

The analysis shows that when we iterate the swap_avail_heads list, we get
node A, but before we access node A, node A is maybe deleted, and by the time
we actually access node A, it no longer exists, as follows:

            CPU1 thread1                                 CPU2 thread2
plist_for_each_entry_safe()
get si->avail_lists[node] from swap_avail_heads
                                             remove si->avail_lists[node] from swap_avail_heads
plist_requeue(&si->avail_lists[node])
BUG_ON(plist_node_empty(node)); // trigger

Due to when we use vendor hook of get_swap_page, the get_swap_pages() function
is overridden, use our own spin_lock to protect when iterate swap_avail_heads
list, but now use native swap_avail_lock spin_lock protect when the
swap_avail_heads list to add and delete nodes, so there will be concurrent
access.

So add vendor hook of add/delete/iterate node for avail_list, in this way, we
can use our own spin_lock to protect the swap_avail_heads list to add, delete
and iterate node.

Due to enable_swap_info function to call vendor hook of add_to_avail_list,
need first init swap_avail_heads, so also add vendor hook of
swap_avail_heads_init.

Due to the vendor hook of __cgroup_throttle_swaprate need to call
blkcg_schedule_throttle function, so export it also.

Bug: 225795494
Change-Id: I03107cbda6310fa7ae85e41b8cf1fa8225cafe78
Signed-off-by: Lincheng Yang <lincheng.yang@transsion.com>
Suggested-by: Bing Han <bing.han@transsion.com>
2023-09-15 19:58:39 +00:00
Vatsal Parasrampuria
b4b7d22830 ANDROID: wakeupbypass: Add vendor hook for batteryswap
Implemented a hook to check if battery swap is enabled in
alarm timer suspend routine. During a battery swap, it is
crucial to ensure that the device remains in a suspended
state, relying on a limited backup power source. It is
essential to prevent any unintended awakenings in this
state, as they could potentially lead to sudden surges
in the power consumption, ultimately resulting in a
device shutdown. Hence, we disable alarmtimer IRQs when
in batteryswap mode.

Bug: 290881352
Change-Id: I31dc30d9a3168bb1356cccba49f0a70fd6b73782
Signed-off-by: Vatsal Parasrampuria <vp9924@zebra.com>
2023-07-20 00:34:49 +00:00
shenjiangjiang
28f1c8e015 ANDROID: vendor_hook: Add hook to abort reclaim and compaction
We need to abort the reclaim/compaction by sending
signal(such as SIGUSR2) to the reclaim thread, or
just abort when cpu-usage is too-high or free-mem is enough.

Bug: 289987875
Change-Id: I4b637cbd2b37235eec27a985a9b5b95598247c59
Signed-off-by: shenjiangjiang <shenjiangjiang@oppo.com>
(cherry picked from commit 024628cc9203cbd4f8471d98435b3a3d6f85764d)
2023-07-18 17:31:55 +00:00
Oven
4782c8cb16 ANDROID: vendor_hook: Add hook to tune readaround size
In some situations, we want to decrease readaround size for better
performance. So we add this hook.

Bug: 288216516
Change-Id: If2f5f75976c99ff1f82ce29d370f9216926055ab
Signed-off-by: Oven <liyangouwen1@oppo.com>
2023-06-30 08:42:41 +00:00
Oven
69a794a283 ANDROID: vendor_hooks: Add hooks to avoid key threads stalled in
memory allocations

We add these hooks to avoid key threads blocked in memory allocation
path.
-android_vh_free_unref_page_bypass  ----We create a memory pool for the key threads. This hook determines whether a page should be free to the pool or to buddy freelist. It works with a existing hook `android_vh_alloc_pages_reclaim_bypass`, which takes pages out of the pool.

-android_vh_kvmalloc_node_use_vmalloc  ----For key threads, we perfer not to run into direct reclaim. So we clear __GFP_DIRECT_RECLAIM flag. For threads which are not that important, we perfer use vmalloc.

-android_vh_should_alloc_pages_retry  ----Before key threads run into direct reclaim, we want to retry with a lower watermark.

-android_vh_unreserve_highatomic_bypass  ----We want to keep more highatomic pages when unreserve them to avoid highatomic allocation failures.

-android_vh_pageset_update  ----We found the default per-cpu pageset is quite few in smartphones with large ram size. This hook is used to increase it to reduce zone->lock contentions.

-android_vh_rmqueue_bulk_bypass  ----We found sometimes when key threads run into rmqueue_bulk,  it took several milliseconds spinning at zone->lock or filling per-cpu pages. We use this hook to take pages from the mempool mentioned above,  rather than grab zone->lock and fill a batch of pages to per-cpu.

Bug: 288216516
Change-Id: I1656032d6819ca627723341987b6094775bc345f
Signed-off-by: Oven <liyangouwen1@oppo.com>
2023-06-30 08:42:41 +00:00
Peifeng Li
64c7044d39 ANDROID: vendor_hook: add hooks in dm_bufio.c
1. android_vh_dm_bufio_shrink_scan_bypass
To adjust dm_bufio-buffer shrinker's policy in some cases.
2. cleanup_old_buffers_bypass
To adjust the policy of dm_bufio-buffer periodic eviction
in some cases.

Bug: 281467813

Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: I29a9d91d18d2e279170533db83b59cfc3b17ebe2
2023-05-22 10:51:36 +08:00
Greg Kroah-Hartman
278dfb09d7 Revert "ANDROID: dma-ops: Add restricted vendor hook"
This reverts commit 9d2ec2e0b6.

The hook android_rvh_setup_dma_ops is not used by any vendor, so remove
it to help with merge issues with future LTS releases.

If this is needed by any real user, it can easily be reverted to add it
back and then the symbol should be added to the abi list at the same
time to prevent it from being removed again later.

Bug: 263236925
Bug: 203756332
Cc: Beata Michalska <beata.michalska@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I7741910039ac9914e2e2adf974204278d37db94d
2023-03-07 11:26:48 +00:00
Liujie Xie
d01f7e1269 ANDROID: vendor_hooks: Add hooks for mutex and rwsem optimistic spin
These hooks help us do the following things:
a) Record the number of mutex and rwsem optimistic spin.
b) Monitor the time of mutex and rwsem optimistic spin.
c) Make it possible if oems don't want mutex and rwsem to optimistic spin
for a long time.

Bug: 267565260
Change-Id: I2bee30fb17946be85e026213b481aeaeaee2459f
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
2023-03-02 18:45:04 +00:00
Beata Michalska
9d2ec2e0b6 ANDROID: dma-ops: Add restricted vendor hook
Add a vendor hook to arch_setup_dma_ops to allow vendors to perform
any necessary post-actions on setting up DMA ops for a given device,
focusing mainly on enabling those to opt-in for the Cortex-A510
erratum 2454944.

Bug: 263236925

Change-Id: I6fd4d3a30829437fc113ec15ca2e5d060a38e60c
Signed-off-by: Beata Michalska <beata.michalska@arm.com>
2023-02-09 18:53:48 +00:00
Suren Baghdasaryan
f677efbea1 Revert "Revert "ANDROID: vendor_hooks:vendor hook for mmput""
This reverts commit 501063ce66.

Reason for revert: The vendor hook is actually needed by a partner

Bug: 238821038
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I1c19add348792967975369a10ec9cb41fa268236
2022-12-24 12:34:20 -08:00
Suren Baghdasaryan
a43cd1f2bb Revert "Revert "ANDROID: vendor_hooks:vendor hook for __alloc_pages_slowpath.""
This reverts commit cc51dcbc60.

Reason for revert: The vendor hooks were reverted but they are needed.

Bug: 243629905
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I4b2eab1a9bf3bbbb200f9d09f2c57fb4d9f2c143
2022-12-24 12:30:22 -08:00
Pavankumar Kondeti
8ad88eae4b ANDROID: dma-buf: Fix build breakage with !CONFIG_DMABUF_SYSFS_STATS
The commit c5589c7eec ("ANDROID: dma-buf: Add vendor hook for
deferred dmabuf sysfs stats release") introduced a build breakage
on non-GKI targets which don't have CONFIG_DMABUF_SYSFS_STATS
enabled. It is due to invisibility of struct dma_buf_sysfs_entry
in the trace hook header file. We can get away with it by moving
the header inclusion from trace hook header to vendor hooks driver.

Bug: 261818075
Change-Id: Ibb79bd67c9f1b36fe2b5d569ab9369f376a78b77
Signed-off-by: Pavankumar Kondeti <quic_pkondeti@quicinc.com>
2022-12-13 21:13:14 +00:00
T.J. Mercier
c5589c7eec ANDROID: dma-buf: Add vendor hook for deferred dmabuf sysfs stats release
This vendor hook allows for the sysfs activity associated with
dma-buf-sysfs-stats teardowns to be performed asynchronously similar
to how the initialization works.

Bug: 254192604
Signed-off-by: T.J. Mercier <tjmercier@google.com>
Change-Id: Ie076d0f8f67b96a97c71d9e6bf90539ebd9807bf
2022-11-14 20:41:03 +00:00
Bing Han
09f4246296 ANDROID: sched: add restricted hooks to replace the former hooks
Fix Bug: scheduling while atomic
In these vendor hooks, we will perform schedule due to competion. This will
lead to kernel exception.
To solve this problem, we need to add these restrcted hooks to replace the
former regular vendor hooks.

Bug: 234214858
Signed-off-by: Bing Han <bing.han@transsion.com>
Change-Id: I151125a7119a91d1339d4790a68a6a4796d673e3
2022-10-24 14:26:09 +08:00
Todd Kjos
d195c9f2bb ANDROID: force struct page_vma_mapped_walk to be defined in KMI
A vendor hook was recently defined that references
struct page_vma_mapped_walk, but it is only forward-declared
and therefore not fully defined in the KMI. Add inclusion of
linux/rmap.h to vender_hooks.c to add the full definition.

Bug: 233047575
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I3bbaca92a70e4464e370e987ae4154de19c4fee2
2022-09-28 16:59:24 +00:00
Pavankumar Kondeti
6d04d8ce90 ANDROID: vendor_hooks: Allow shared pages reclaim via MADV_PAGEOUT
Add a hook in madvise_cold_or_pageout_pte_range() to allow
vendor modules to influence the shared pages reclaim.

Bug: 242678506
Change-Id: I269a385b59f7291c2e96478674bb3d05f94584cb
Signed-off-by: Pavankumar Kondeti <quic_pkondeti@quicinc.com>
2022-09-26 19:36:39 +05:30
Todd Kjos
c6f7a0ebd8 ANDROID: make sure all types for hooks are defined in KMI
There are 2 remaining types directly referenced by vendor
hooks that were not fully-defined in the KMI:

struct gic_chip_data : defined in include/linux/irqchip/arm-gic-v3.h
struct swap_slots_cache : defined include/linux/swap_slots.h

libabigail is not finding definitions based on the instantiation
of the hooks, so force them to be defined by defining dummy exported
symbols.

Update XML with the now visible definitions

Bug: 233047575
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I521b2a596e1d7361d0f44a87ffe330186896b9f8
2022-09-22 19:37:51 +00:00
Todd Kjos
b9ac329a83 ANDROID: force struct selinux_state to be defined in KMI
struct selinux_state is defined in security/selinux/include/security.h,
however libabigail is not finding its definition based on the
instantiation of the hooks, so force it to be defined by defining a
dummy exported symbol. Since blk_mq_alloc_data is defined in a
subsystem-private header, create a new vendor_hooks.c file in
security/selinux to define the dummy symbol.

Bug: 233047575
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: Ia505c76db2eed339b3815073f847b500535cc954
2022-09-22 19:37:51 +00:00
Peifeng Li
5c5b7a4da6 ANDROID: vendor_hook: rename the the name of hooks
Renamed trace_android_vh_record_percpu_rwsem_lock_starttime to
trace_android_vh_record_pcpu_rwsem_starttime.

Because the orignal name is too long, which results to the
compile-err of .ko that uses the symbol:

ERROR: modpost:
too long symbol "__tracepoint_android_vh_record_percpu_rwsem_lock_starttime"

There is not any users of the the orignal hooks so that it is safe to
rename it.

Bug: 241191475
Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: Ie246a933414db5e9e28a65a4c280fae3a1cbefe3
2022-09-22 10:18:45 +00:00
Greg Kroah-Hartman
cc51dcbc60 Revert "ANDROID: vendor_hooks:vendor hook for __alloc_pages_slowpath."
This reverts commit dec2f52d08.

The hooks android_vh_alloc_pages_reclaim_bypass and
android_vh_alloc_pages_failure_bypass are not used by any vendor, so
remove it to help with merge issues with future LTS releases.

If this is needed by any real user, it can easily be reverted to add it
back and then the symbol should be added to the abi list at the same
time to prevent it from being removed again later.

Bug: 203756332
Bug: 243629905
Cc: xiaofeng <xiaofeng5@xiaomi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Id313f6971e0b5437fcfc1ed3f8d4c56706217133
2022-09-21 16:35:44 +02:00
Peifeng Li
db2516ff46 ANDROID: vendor_hooks: Add hooks for lookaround
Add hooks for support lookaround in memory reclamation.
add drivers/android/vendor_hooks.c for export tracepoint symbol

Bug: 241079328

Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: Ia6e9fa0ae5708e88fa498c63cf63aad7c55e5f98
2022-09-15 17:47:49 +08:00
liang zhang
feedd14d14 Revert "Revert "ANDROID: add for tuning readahead size""
This reverts commit 98e5fb34d1.

Reason for revert: <have add the abi list:https://android-review.googlesource.com/c/kernel/common/+/2217063>

Bug: 246685233
Change-Id: Ic18a59bd77040fe58cc1e09678a707d3802f2bb4
Signed-off-by: liang zhang <liang.zhang@transsion.com>
2022-09-14 16:34:41 +00:00
xiaofeng
dec2f52d08 ANDROID: vendor_hooks:vendor hook for __alloc_pages_slowpath.
add vendor hook in __alloc_pages_slowpath ahead of
__alloc_pages_direct_reclaim and warn_alloc.

Bug: 243629905
Change-Id: Ieacc6cf79823c0bfacfdeec9afb55ed66f40d0b0
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
(cherry picked from commit 0312e9cd22b100a088ff64ab36b2db2eb9f28b7c)
2022-08-26 21:58:44 +00:00
Greg Kroah-Hartman
7b0822a261 Revert "ANDROID: vendor_hooks: tune reclaim scan type for specified mem_cgroup"
This reverts commit e5b4949bfc.

The hook android_vh_tune_memcg_scan_type is not used by any vendor, so
remove it to help with merge issues with future LTS releases.

If this is needed by any real user, it can easily be reverted to add it
back and then the symbol should be added to the abi list at the same
time to prevent it from being removed again later.

Bug: 203756332
Bug: 230450931
Cc: xiaofeng <xiaofeng5@xiaomi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I0e32c24d67a9ede087eca5005796512a9451c1e2
2022-08-24 18:50:22 +00:00
Greg Kroah-Hartman
98e5fb34d1 Revert "ANDROID: add for tuning readahead size"
This reverts commit f06daa5a0b.

The hook android_vh_ra_tuning_max_page is not used by any vendor, so
remove it to help with merge issues with future LTS releases.

If this is needed by any real user, it can easily be reverted to add it
back and then the symbol should be added to the abi list at the same
time to prevent it from being removed again later.

Bug: 203756332
Bug: 229839032
Cc: liang zhang <liang.zhang@transsion.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Id9211dfd9e1fa19d2ccb14302c60f0d55579f59d
2022-08-24 17:07:12 +02:00
Greg Kroah-Hartman
486580ffb5 Revert "ANDROID: vendor_hooks: Add hooks for mutex"
This reverts commit 8c3ac02bca.

The hook android_vh_mutex_start_check_new_owner is not used by any
vendor, so remove it to help with merge issues with future LTS releases.

If this is needed by any real user, it can easily be reverted to add it
back and then the symbol should be added to the abi list at the same
time to prevent it from being removed again later.

Bug: 203756332
Bug: 231647361
Cc: Liujie Xie <xieliujie@oppo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I8c3bf787525d684f64b8d0654d379df78eb7b69e
2022-08-24 17:07:08 +02:00
xieliujie
548da5d23d ANDROID: vendor_hooks: Add hooks for oem futex optimization
If an important task is going to sleep through do_futex(),
find out it's futex-owner by the pid comes from userspace,
and boost the owner by some means to shorten the sleep time.
How to boost? Depends on these hooks:
53e8099784 ("ANDROID: vendor_hooks: Add hooks for scheduler")

Bug: 243110112
Signed-off-by: xieliujie <xieliujie@oppo.com>
Change-Id: I9a315cfb414fd34e0ef7a2cf9d57df50d4dd984f
2022-08-24 00:15:59 +00:00
Manaf Meethalavalappu Pallikunhi
a3e8b04796 ANDROID: thermal: vendor hook to disable thermal cooling stats
Add vendor hook to thermal to allow vendor to selectively disable
thermal cooling device stats feature based on requirement. It helps
vendor to optimize memory footprint due to this feature especially
for low memory devices.

Bug: 218825214
Change-Id: I2ec72505f03575e09229c54765584614b16a3904
Signed-off-by: Manaf Meethalavalappu Pallikunhi <quic_manafm@quicinc.com>
(cherry picked from commit f6e47fd00f24d5e814d316b03974e970dd87879e)
2022-08-23 15:03:59 +00:00
Bing Han
a47fb6a9ae ANDROID: vendor_hook: Add hook in __free_pages()
This reverts commit eb99e6d80e

The hook android_vh_free_pages is deleted, due to the symbol is
not added to the abi list. The symbol is added to the abi list in
patch:2183484. This patch is to add the hook android_vh_free_pages
again.

Bug: 234214858
Bug: 203756332
Cc: Greg Kroah-Hartman <gregkh@google.com>
Signed-off-by: Bing Han <bing.han@transsion.com>
Change-Id: I2c97ea4d310e2004b94d891678127c17f7b07c93
2022-08-19 15:01:45 +00:00
Bing Han
6c56a05b87 ANDROID: vendor_hooks: Add hooks to extend the struct swap_info_struct
This reverts commit: d0590b99c9

The hooks android_vh_init_swap_info_struct and android_vh_alloc_si
are deleted, due to the symbols are not added to the abi list. The
symbols are added to the abi list in patch:2183484. This patch is to
add the hooks android_vh_init_swap_info_struct and android_vh_alloc_si
again.

Bug: 234214858
Bug: 203756332
Cc: Greg Kroah-Hartman <gregkh@google.com>
Signed-off-by: Bing Han <bing.han@transsion.com>
Change-Id: Id5524a726d213c5eab55570fd28d28da978974e7
2022-08-19 15:01:45 +00:00
Bing Han
7449d8120a ANDROID: vendor_hook: Add hook in si_swapinfo()
This reverts commit 86be1a3d9f

The hook android_vh_si_swapinfo is deleted, due to the symbol
is not added to the abi list. The symbol is added to the abi
list in patch:2183484. This patch is to add the hook
android_vh_si_swapinfo again.

Bug: 234214858
Bug: 203756332
Cc: Greg Kroah-Hartman <gregkh@google.com>
Signed-off-by: Bing Han <bing.han@transsion.com>
Change-Id: Ifd1e05f44ac04b67816618139badd5c2ee786b50
2022-08-19 15:01:45 +00:00
Greg Kroah-Hartman
86be1a3d9f Revert "ANDROID: vendor_hook: Add hook in si_swapinfo()"
This reverts commit ed2b11d639.

The hook android_vh_si_swapinfo is not used by any vendor, so remove it
to help with merge issues with future LTS releases.

If this is needed by any real user, it can easily be reverted to add it
back and then the symbol should be added to the abi list at the same
time to prevent it from being removed again later.

Bug: 203756332
Bug: 234214858
Cc: Bing Han <bing.han@transsion.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ib474a0911dd97d54d2f086258e9d53ddd3451967
2022-08-17 07:58:13 +02:00
Greg Kroah-Hartman
40b3533213 Revert "ANDROID: vendor_hooks:vendor hook for pidfd_open"
This reverts commit 242b11e574.

The hook android_vh_pidfd_open is not used by any vendor, so remove it
to help with merge issues with future LTS releases.

If this is needed by any real user, it can easily be reverted to add it
back and then the symbol should be added to the abi list at the same
time to prevent it from being removed again later.

Bug: 203756332
Bug: 238725692
Cc: xiaofeng <xiaofeng5@xiaomi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I77afe002bebc3b3e97ea7a28faae74e9cb8a6718
2022-08-17 07:58:13 +02:00
Greg Kroah-Hartman
d0590b99c9 Revert "ANDROID: vendor_hooks: Add hooks to extend the struct swap_info_struct"
This reverts commit 667f0d71dc.

The hooks android_vh_init_swap_info_struct and android_vh_alloc_si are
not used by any vendor, so remove it to help with merge issues with
future LTS releases.

If this is needed by any real user, it can easily be reverted to add it
back and then the symbol should be added to the abi list at the same
time to prevent it from being removed again later.

Bug: 203756332
Bug: 234214858
Cc: Bing Han <bing.han@transsion.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: If01c284ebf15e804e7cf34e854b7db0d5b68ae1b
2022-08-17 07:58:13 +02:00
Greg Kroah-Hartman
501063ce66 Revert "ANDROID: vendor_hooks:vendor hook for mmput"
This reverts commit 8b19ed264b.

The hook android_vh_mmput is not used by any vendor, so remove it to
help with merge issues with future LTS releases.

If this is needed by any real user, it can easily be reverted to add it
back and then the symbol should be added to the abi list at the same
time to prevent it from being removed again later.

Bug: 203756332
Bug: 238821038
Cc: xiaofeng <xiaofeng5@xiaomi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Idd40f231640723d2342a9dbac7e9206a800e82dd
2022-08-17 05:54:29 +00:00
Greg Kroah-Hartman
eb99e6d80e Revert "ANDROID: vendor_hook: Add hook in __free_pages()"
This reverts commit 01680ae117.

The hook android_vh_free_pages is not used by any vendor, so remove it
to help with merge issues with future LTS releases.

If this is needed by any real user, it can easily be reverted to add it
back and then the symbol should be added to the abi list at the same
time to prevent it from being removed again later.

Bug: 203756332
Bug: 234214858
Cc: Bing Han <bing.han@transsion.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I36d4bfb83e1605c6fd1f9ff8dcd39cdbcdef8760
2022-08-16 18:05:09 +00:00
Greg Kroah-Hartman
8d86846781 Revert "ANDROID: vendor_hooks: Add hooks for binder"
This reverts commit acefa91e51.

The hooks trace_android_vh_binder_proc_transaction_entry and
trace_android_vh_binder_select_worklist_ilocked are not used by any
vendor, so remove it to help with merge issues with future LTS releases.

If this is needed by any real user, it can easily be reverted to add it
back and then the symbol should be added to the abi list at the same
time to prevent it from being removed again later.

Bug: 203756332
Bug: 219898723
Cc: Liujie Xie <xieliujie@oppo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I2c04e60fa9d6eb6d85be7882d12f1b70956b8e80
2022-08-16 18:05:09 +00:00
Peifeng Li
eed2741ae6 ANDROID: vendor_hook: add hooks to protect locking-tsk in cpu scheduler
Providing vendor hooks to record the start time of holding the lock, which
protects rwsem/mutex locking-process from being preemptedfor a short time
in some cases.

- android_vh_record_mutex_lock_starttime
- android_vh_record_rtmutex_lock_starttime
- android_vh_record_rwsem_lock_starttime
- android_vh_record_percpu_rwsem_lock_starttime

Bug: 241191475

Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: I0e967a1e8b77c32a1ad588acd54028fae2f90c4e
2022-08-16 11:24:12 +00:00
Peifeng Li
1f8f6d59a2 ANDROID: vendor_hook: Add hook to not be stuck ro rmap lock in kswapd or direct_reclaim
Add hooks to support trylock in rmaplock when reclaiming in kswapd or
direct_reclaim, in order to avoid wait lock for a long time.

- android_vh_handle_failed_page_trylock
- android_vh_page_trylock_set
- android_vh_page_trylock_clear
- android_vh_page_trylock_get_result
- android_vh_do_page_trylock

Bug: 240003372

Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: I0f605b35ae41f15b3ca7bc72cd5f003175c318a5
2022-08-14 23:08:07 +08:00
Peifeng Li
e56f8712cf ANDROID: vendor_hooks: protect multi-mapcount pages in kernel
Support two hooks as follows to protect multi-mapcount pages in kernel:

- trace_android_vh_page_should_be_protect
- trace_android_vh_mapped_page_try_sorthead

Bug: 236578020
Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: I688aceabf17d9de2feac7c3ad7144d307de6ef29
2022-08-03 20:10:45 +00:00
Peifeng Li
3f775b9367 ANDROID: vendor_hooks: account page-mapcount
Support five hooks as follows to account
the amount of multi-mapped pages in kernel:

- android_vh_show_mapcount_pages
- android_vh_do_traversal_lruvec
- android_vh_update_page_mapcount
- android_vh_add_page_to_lrulist
- android_vh_del_page_from_lrulist

Bug: 236578020
Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: Ia2c7015aab442be7dbb496b8b630b9dff59ab935
2022-08-03 20:10:45 +00:00
Peifeng Li
6532784c78 ANDROID: vendor_hooks: add hooks for remove_vm_area.
Provide a vendor hook to remove additional fields when remove_vm_area
for slab/vmalloc memory leak debugging.

Bug: 240869642
Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: Iafecd7c6e75cdc2df0e77ae105283590d8852f74
2022-08-01 21:01:48 +00:00