Commit Graph

1015 Commits

Author SHA1 Message Date
Minchan Kim 8f50042a2f ANDROID: add vendor hooks and expoert reclaim_pages to reclaim memory
Add vendor hooks to reclaim MADV_PAGEOUT memory for asynchrnous
device. It also exports reclaim_pages to reclaim memory.

Bug: 326662423
Change-Id: Ic2516c64a9dbd53173a3bfb19b6cd21636916c27
Signed-off-by: Minchan Kim <minchan@google.com>
(cherry picked from commit 1c0a654f8baeac62ce37e63503a8beb71981dba2)
Signed-off-by: Dmitry Skiba <dskiba@google.com>
2025-03-24 18:11:13 +00:00
Robin Hsu 1333f31c55 ANDROID: mm: vh for compaction begin/end
Add vendor hook for compaction begin/end.  The first use would be
to measure compaction durations.

Bug: 229927848
Test: echo 1 > /proc/sys/vm/compact_memory and observe output change in
/sys/kernel/pixel_stat/mm/compaction/mm_compaction_duration
Signed-off-by: Robin Hsu <robinhsu@google.com>
Change-Id: I3d95434bf49b37199056dc9ddfc36a59a7de17b7
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit 13b6bd38bb1f43bfffdb08c8f3a4a20d36ccd670)
Signed-off-by: liangjlee <liangjlee@google.com>
(cherry picked from commit 33b9d9889640fa6825e31e3026f619d66bc7f017)
Signed-off-by: Dmitry Skiba <dskiba@google.com>
2025-03-24 18:11:13 +00:00
Minchan Kim fc348be916 ANDROID: vendor_hooks: add restricted vendor hook for meminfo
To report vendor-specific memory statistics, add restricted
vendor hook since normal vendor hook work with only atomic
context.

Bug: 333482947
Change-Id: I5c32961b30f082a8a4aa78906d2fce1cdf4b0d2b
Signed-off-by: Minchan Kim <minchan@google.com>
(cherry picked from commit 7ea01ee68e6867798309cf0d3044a695b7d56947)
Signed-off-by: Dmitry Skiba <dskiba@google.com>
2025-03-24 18:11:13 +00:00
Chiawei Wang 5f7004a8d0 ANDROID: mm: Add vendor hook in filemap_get_folio()
Add a vendor hook for pagecache hit/miss and other
vendor specific functions.

Bug: 174088128
Bug: 172987241
Signed-off-by: Chiawei Wang <chiaweiwang@google.com>
Change-Id: Ie9f14a69a86b8ed81de766e44e30f2eba1d9bd84
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit db158b4ae0543446d38313c3da942afee9947267)
Signed-off-by: Jack Lee <liangjlee@google.com>
(cherry picked from commit cbac5cbf85540c043d1ddb917f288ebfe62bbca7)
Signed-off-by: Dmitry Skiba <dskiba@google.com>
2025-03-24 18:11:13 +00:00
Chiawei Wang ae3f6c72e7 ANDROID: mm: Add vendor hook in rmqueue()
Add a vendor hook for costly order page counting
and other vendor specific functions.

Bug: 174521902
Bug: 172987241
Signed-off-by: Chiawei Wang <chiaweiwang@google.com>
Change-Id: I89206727a462548cc3500b695d85c83ff003eec7
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit 369de3780428a17e9afece2f5747f03619d589b6)
Signed-off-by: liangjlee <liangjlee@google.com>
(cherry picked from commit 86a45bb2dc315fd0b1d0b513b0f2e1be82d25f70)
Signed-off-by: Dmitry Skiba <dskiba@google.com>
2025-03-24 18:11:09 +00:00
Qixia Yang dc524f0ad6 ANDROID: vendor_hooks: Add hooks for exiting control
Add hooks at process exiting routines so that oems
can control these procedures. One possible benifit is the peak of
system load can be shaved and load can be more smooth when a large
number of threads is killed once upon a time, while a sudden peak
of system load can probably lead to user junk issues.

Bug: 296493318
Change-Id: Ied4cc968e45baa39f1b79e8c7dce75cf6b8db55d
Signed-off-by: Qixia Yang <yangqixia2@oppo.com>
2025-03-24 17:19:41 +08:00
Prakruthi Deepak Heragu b41a7537a4 ANDROID: gunyah: vcpu_mgr: Add trace_hooks in the gunyah_vcpu driver
As QTVMs use Gunyah emulated watchdog instead of vcpu_stall detector,
provide trace_hooks to manage the watchdog of the QTVM.

Bug: 399219478
Change-Id: I6ec8a0236835dcc20c66681a747eae09c0c1a32d
Signed-off-by: Prakruthi Deepak Heragu <quic_pheragu@quicinc.com>
2025-03-20 23:38:59 -07:00
Alice Ryhl dd55f14624 ANDROID: binder: change how Rust Binder is loaded
The binder.impl parameter currently controls whether C Binder is loaded
or not, even if no Rust Binder driver is present. This patch changes it
so that C Binder always gets loaded even if binder.impl=rust is set. To
actually load a different Binder driver, it must explicitly ask C Binder
to unload itself.

This ensures that:
1. If binder.impl=rust is set on a device without Rust Binder available,
   it will boot normally with C Binder instead of failing to boot.
2. By not listing unload_binder in the symbol list, we ensure that
   Binder can only be loaded as a GKI module, not as a vendor module.

Bug: 388786466
Change-Id: I791154e8f10abd5c470bb697b5e1035c33af897f
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
2025-03-20 00:14:17 -07:00
liwei c837e3a95d ANDROID: vendor_hooks: add hooks for adjust kvmalloc_node alloc_flags
since we can't control all kvmalloc_node callsite's gfp_flags, we add
a vendor hook in kvmalloc_node to tune the reclaim behavior for some
really high-order allocation

Bug: 300857012
Bug: 395197442
Change-Id: I5f0c4c2921d204289911704e3a205f6a1dc50d04
Signed-off-by: liwei <liwei1234@oppo.com>
Signed-off-by: wengle <wengle@oppo.com>
2025-03-20 01:26:39 +00:00
Bibek Kumar Patro 7acbeed030 ANDROID: mm/cma: Introduce vendor hooks for best fit CMA allocation
Introduce vendor hooks for best fit mechanism of
CMA allocation.

Bug: 379357530
Change-Id: I8149b0ba1c69d3482e726b6ff5227e8344aed6aa
Signed-off-by: Bibek Kumar Patro <quic_bibekkum@quicinc.com>
2025-03-19 13:41:08 +00:00
Qianfeng Rong 3b8d7fd2b0 ANDROID: vendor hooks: Add hooks to skip mglru aging
For direct memory reclaim, aging can be skipped, and threads such as
kswapd can be allowed to execute, reducing the time spent on direct
memory reclaim.

Why do we need to reseve 6 u64s OEM data?
The two u64s parameters are used to tell kswapd how to age this lrugen.
The other four u64s are used for two list heads to store some special
pages.

The size of 'struct lru_gen_folio' only affects the size of
'struct lruvec', the size of 'struct mem_cgroup_per_node' and
the size of 'struct pglist_data'.

The influence of OEM data:
sizeof(struct lru_gen_folio) is changed from 960 to 1008.
sizeof(struct lruvec) is changed from 1176 to 1224.
sizeof(struct mem_cgroup_per_node) is changed from 1472 to 1536.
sizeof(struct pglist_data) is changed from 7424 to 7488.

The 'struct mem_cgroup_per_node' is alloc for in
alloc_mem_cgroup_per_node_info() using kzalloc_node(). while
the size of 'struct mem_cgroup_per_node' is 1472Byte. Due to
alignment reasons, the memory size allocate is 2KB. Adding 6 u64s
will not increase the alloc size.

Bug: 402316914
Change-Id: Ib9667e83a8227a36e3adc63e84d73a6b529000a8
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.corp-partner.google.com>
[cmllamas: switch can_swap to swappiness]
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2025-03-19 13:41:07 +00:00
Qianfeng Rong 081bb422e2 ANDROID: vendor hooks: Add hooks to abort scan memcgs
The more memcg groups there are, the longer a single traversal takes,
resulting in poor consistency in memory recycling time.
It is possible to interrupt memcg traversal recycling to speed up
memory application for some important processes.

Bug: 402041892

Change-Id: I8b9a0cce754cb07babe0ce234fbf262b20f9d020
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.corp-partner.google.com>
2025-03-19 13:28:29 +00:00
Liujie Xie 293d51412c ANDROID: vendor_hooks: add hooks for slab memory leak debugging
Add hooks and additional fields in vm_struct and track structs
to store and report additional information for slab memory leak
debugging.

Bug: 184928480
Bug: 395197442
Change-Id: I6897a6a98d4eaaea492673cefd4111a7ba741940
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Signed-off-by: wengle <wengle@oppo.com>
2025-03-19 13:18:09 +00:00
Liujie Xie 3404298ae0 ANDROID: Fix lost track action type in save_track_hash
Transmit the track action type to save_track_hash, otherwise we do not
know it is allocation stack or free stack.

Fixes: 8bc6337823c6 ("ANDROID: vendor_hooks: add hooks for slab memory leak debugging")
Bug: 184928480
Bug: 395197442
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I74c50c02cfb4ebbf3e9fecdf125e76946ff4e7d1
(cherry picked from commit 7d216e2512082853f4cf0c220a1b48119203144f)
Signed-off-by: huzhanyuan <huzhanyuan@oppo.com>
Signed-off-by: wengle <wengle@oppo.com>
2025-03-19 13:18:08 +00:00
xiaofeng 203b0df23a 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
Bug: 395197442
Change-Id: Ieacc6cf79823c0bfacfdeec9afb55ed66f40d0b0
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
Signed-off-by: huzhanyuan  <huzhanyuan@oppo.com>
Signed-off-by: wengle <wengle@oppo.com>
2025-03-19 13:18:08 +00:00
Oven 2ad4928594 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
Bug: 395197442
Change-Id: If2f5f75976c99ff1f82ce29d370f9216926055ab
Signed-off-by: Oven <liyangouwen1@oppo.com>
Signed-off-by: huzhanyuan  <huzhanyuan@oppo.com>
Signed-off-by: wengle <wengle@oppo.com>
2025-03-19 13:18:08 +00:00
liang zhang b6f24657f2 ANDROID: add for tuning readahead size
Tune ReadAhead size for better memory usage and performance.
accordding to Read-Ahead Efficiency on Mobile Devices: Observation,
Characterization, and Optimization form IEEE

Bug: 229839032
Bug: 395197442
Change-Id: I91656bde5e616e181fd7557554d55e7ce1858136
Signed-off-by: liang zhang <liang.zhang@transsion.com>
Signed-off-by: Oven <liyangouwen1@oppo.com>
Signed-off-by: huzhanyuan  <huzhanyuan@oppo.com>
Signed-off-by: wengle <wengle@oppo.com>
2025-03-19 13:18:08 +00:00
JohnHsu 21c64f5a21 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
Bug: 330661608
Bug: 395197442
Change-Id: Id6e0a97003f0a156cff4d0996bc38bcd89b1dc69
Signed-off-by: John Hsu <john.hsu@mediatek.com>
Signed-off-by: wengle <wengle@oppo.com>
2025-03-19 13:18:08 +00:00
Liujie Xie 3972d43fc4 ANDROID: vendor_hooks: Add hooks for __alloc_pages_direct_reclaim
Provide a vendor hook to allow drain_all_pages to be skipped
during direct reclaim in some cases to avoid delays caused by
it in cases when the benefits of draining pcp lists are known
to be small.

Bug: 220811627
Bug: 234405962
Bug: 395197442
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I0805241f81e0a94afcf62c98e97cff125d4061e2
Signed-off-by: wengle <wengle@oppo.com>
2025-03-19 13:18:08 +00:00
wudean 6dd826c792 ANDROID: vendor_hooks: bypass shrink slab
Add hooks for bypass shrink slab.

Bug: 185951972
Bug: 395197442
Change-Id: I343e02ae5cd6d076d525d0e4bfc09ecdfeda1d7b
Signed-off-by: wudean <dean.wu@vivo.com>
Signed-off-by: wengle <wengle@oppo.com>
2025-03-19 13:18:07 +00:00
Oven 1de7425d75 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_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
Bug: 395197442
Change-Id: I1656032d6819ca627723341987b6094775bc345f
Signed-off-by: Oven <liyangouwen1@oppo.com>
Signed-off-by: huzhanyuan  <huzhanyuan@oppo.com>
Signed-off-by: wengle <wengle@oppo.com>
2025-03-17 10:09:14 -07:00
Bo Lan 28b35bdaea ANDROID: writeback: add vendor hooks to do a hierarchical writeback control
For short-life or high-IO-freq files we marked, the writeback tasks
will act on an additional writeback dispatching list, achieving
hierarchical control of dirty writeback without affecting other original
writeback tasks.

Bug: 400883625
Change-Id: I7973cedeb15896d2cd2224443bf857111b2adac7
Signed-off-by: Bo Lan <lanbo@honor.com>
2025-03-13 14:33:59 -07:00
xiaofeng 9fec5f6775 ANDROID: psi: Add vendor hooks for PSI tracing
Add hooks to capture various per-zone memory stats when
a trigger threshold is hit.
In the stability Monkey4SystemLongTime test, the camera startup will
request a large amount of memory in a short period of time,
resulting in a temporary shortage of system memory. In addition,
other processes also need to continuously request memory.In this
case, it is easy for the system to have lmkd blocked and unable to
kill the process in time, resulting in OOM.

This hook can be used to detect when lmkd is in D state and the 
memory pressure meets the set conditions, then the kill process 
mechanism is triggered to avoid the occurrence of OOM. In the
previous test, 1/20 machines had a problem at 74.49 hours,but after
the modification, 48 machines were tested for 120 hours without
any problems.

Bug: 268290366
Change-Id: Ibe39263ddb05ffc3fa63b5225497a90c6480c8d7
Signed-off-by: Georgi Djakov <quic_c_gdjako@quicinc.com>
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
2025-03-12 11:15:08 -07:00
Jiewen Wang e140f1a43f ANDROID: vendor_hooks: Add tune scan type hook in get_scan_count()
Add hook in get_scan_count() for oem to wield customized reclamation strategy

Bug: 294180281
Bug: 336401947
Change-Id: Ic54d35128e458661fc2b641809f5371b1d9a488e
Signed-off-by: Jiewen Wang <jiewen.wang@vivo.com>
Signed-off-by: huzhanyuan <huzhanyuan@oppo.com>
2025-03-11 11:57:47 -07:00
chenweitao 69297c886b ANDROID: vendor_hooks: Add hook for binder_alloc_new_buf_locked
Add hook for binder_alloc_new_buf_locked, which gives the vendor a
choice whether or not this alloc new buf should go on or not.

Bug: 322915513
Change-Id: Ie7f1567dae6dee0fb22b014cd1eacc3308ccb205
Signed-off-by: chenweitao <chenweitao@oppo.com>
2025-03-10 13:04:31 -07:00
Jaewon Kim c230b7b9ce ANDROID: vendor_hooks: add hook for si_meminfo_adjust_shmem
As trace_android_vh_si_meminfo_adjust allows vendors to change for
totalram and freeram, we'd like to change sharedram values. This is
helpful when a driver uses shmem a lot.

Bug: 371132125

Change-Id: Ifd615e1a4d600084f3957267da3189f0edc342e7
Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
2025-03-10 10:09:24 -07:00
Jaewon Kim b235667f92 ANDROID: vendor_hooks: add hook for shmem memory stat
Add some vendor hooks for shmem memory stats. This help us track the
number of shmem pages which are belong to the mapping we're interested
in. If shmem pages are swapped out, we can track that number, too.

Bug: 372282099

Change-Id: I0a18a690f37719400faa4a01b1d5d09e979f09c7
Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
2025-03-10 10:09:24 -07:00
Charan Teja Kalla add2b5a560 ANDROID: mm: shmem: add vendor hooks in shmem folio allocation path
Add vendor hooks in shmem folio allocation paths to tune the higher
order folios.
With vendor hook possibly overriding shmem_allowable_huge_orders()
result, `order` inside shmem_get_folio_gfp() becomes variable when
when CONFIG_TRANSPARENT_HUGEPAGE=n and the block that calls
vma_thp_gfp_mask() is not compiled out anymore, leading to the
following linker error:

ld.lld: error: undefined symbol: vma_thp_gfp_mask
>>> referenced by shmem.c

Fix this by making the block dependent on CONFIG_TRANSPARENT_HUGEPAGE.

Bug: 397599006
Change-Id: Ia0e126c674a9f08cb10fe5ee06f5efac7b5cbe7f
Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2025-03-07 09:05:28 -08:00
yipeng xiang 99818c18b2 ANDROID: mm: create vendor hooks for mm lru_lazyfree
Add vendor hook to add lazyfree to lru tail in lru_lazyfree

Bug: 396330858
Change-Id: I3d421992811fa87cf1c5c45cfe2a08e06004da83
Signed-off-by: yipeng xiang <yipengxiang@honor.corp-partner.google.com>
2025-03-06 11:32:48 -08:00
Yuxuan Yan 2189ba4dcc ANDROID: GKI: add vendor hooks android_vh_page_should_be_protected() and android_vh_page_referenced_check_bypass().
add two vendor hooks:
    android_vh_page_should_be_protected():protect pages from memory
reclaim.
    android_vh_page_referenced_check_bypass():bypass rmap in active list
shrink.

The new vendor data field in scan_control are used to track how many
pages are protected in current reclaim and the "protected / scanned"
rate. These parameters are useful for understanding the impact of page
protection operations on LRU and reclaim, helping us make better
decsions.

Bug: 399782297
Change-Id: I49567a4b1f978821a94da0a8339b2b8fdfd52daf
Signed-off-by: Yuxuan Yan <yanyuxuan3@xiaomi.corp-partner.google.com>
2025-03-06 09:53:43 -08:00
zhengding chen 02ea01fd0f ANDROID: vendor_hooks: Add hooks for binder proc transaction
When servicemanager process added service proxy from other process
register the service, we want to know the matching relation between
handle in the process and service name. When binder transaction
happened, We want to know what process calls what method on what service.

Patch 3482670 was uploaded in this patchset to avoid conflict.

Bug: 186604985
Bug: 395737475

Signed-off-by: zhengding chen <chenzhengding@oppo.com>
Change-Id: I813d1cde10294d8665f899f7fef0d444ec1f1f5e
Signed-off-by: shenshen mao <maoshenshen@oppo.com>
Signed-off-by: xiaosa liang <liangxiaosa@oppo.com>
2025-03-05 12:56:42 -08:00
Fuchun Liao f831b886d2 ANDROID: binder: Add vendor hooks to implement the feature of
binder_proc->fg_todo list

1. The implementation logic of this feature
1) In trace_android_vh_binder_list_add_work, record the sequence of work, work->android_oem_data1 = atomic64_inc_return(&binder_work_seq).
2) In the binder_proc_transaction() function, for special synchronized
binders, if a thread is not found, t->work will be added to proc->fg_todo in trace_android_vh_binder_special_task().
3) binder_thread_read() -> trace_android_vh_binder_select_special_worklist()
will select work to execute from proc->fg_todo according to a specific
algorithm, such as selecting the thread->todo first, then selecting two
proc->fg_todo works, and then one proc->todo work, while taking into account the sequence of work (work->android_oem_data1).
proc->ANDROID_OEM_DATA(1) is used to generate proc->fg_todo list, and it
was committed in the id 8a3740893d9957783493364b118282daa71695cc by other colleagues.

2. trace_android_vh_binder_list_add_work: record the sequence of work.

3. trace_android_vh_binder_has_proc_work_ilocked: Check if there is work
in proc->fg_todo list, and if so, then binder_wakeup_proc_ilocked.

4. trace_android_vh_binder_check_special_work: release the work on
proc->fg_todo list, and print the binder work on fg_list.

Bug: 334746237
Bug: 395737475

Change-Id: I855618ee129fe1bb5925b169d24eb2301ad90664
Signed-off-by: Fuchun Liao <lfc@oppo.com>
2025-02-26 13:34:14 -08:00
Chenghao Zhao 0ebf9a330d ANDROID: GKI: net: add vendor hook for network quality estimation
1.android_vh_tcp_rcv_rtt_update
To record the rcv rtt and its update time.

We use "srtt_us" in tcp_sock struct to judge the network quality.
But sometimes, an uplink request is sent, and downlink data is received for a long time.
During this period, the "srtt_us" is not updated, but the "rcv_rtt_est" may be updated.
So in this case, we may choose to use rcv rtt instead of rtt to judge the network quality.

Bug: 398691197
Change-Id: I92b26b4302ff7ea5cbabaa9bb3bb71dacfe702db
Signed-off-by: Chenghao Zhao <zhaochenghao@honor.com>
2025-02-26 13:20:17 -08:00
litao 4713550a59 ANDROID: vendor_hooks: add vendor hook for nanosleep syscall
Through this vendor hook, we can get the timing to check
current running task for the validation of its credential
and nanosleep operations. through this we can filter some
app tasks which may fire the nanosleep events storm.

Bug: 396244637
Bug: 341618050
Change-Id: I644ac3d217930aa0a50966996e8001e27ce8a501
Signed-off-by: litao <tao.li@vivo.corp-partner.google.com>
(cherry picked from commit 1d9ed15534d4988da3ac56dd7892d37bf5f96847)
2025-02-25 17:23:27 -08:00
Liujie Xie 823bff6408 ANDROID: vendor_hooks: Add hooks for futex
We want to use this hook to record the sleeping time due to Futex

Bug: 210947226

Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I637f889dce42937116d10979e0c40fddf96cd1a2
(cherry picked from commit a7ab784f601a93a78c1c22cd0aacc2af64d8e3c8)
Signed-off-by: maoshenshen <maoshenshen@oppo.com>
2025-02-25 17:07:37 -08:00
Zhuguangqing 09c3bee386 ANDROID: Add vendor hooks for binder perf tuning
Add some hooks in the binder module so that we can do task dependency analysis and statistical work in OEM's module for further optimization.

Bug: 235925535
Bug: 281920779

Signed-off-by: Zhuguangqing <zhuguangqing@xiaomi.com>
Change-Id: Id47e59c4e3ccd07b26eef758ada147b98cd1964e
Signed-off-by: heshuai1 <heshuai1@xiaomi.com>
2025-02-25 08:44:44 -08:00
xieliujie 5723a22d27 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>
2025-02-24 18:31:29 -08:00
xieliujie 3d98011e2a 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_pcpu_rwsem_starttime

This commit is a combination of the following three commits.
https://android-review.googlesource.com/c/kernel/common/+/2579595
https://android-review.googlesource.com/c/kernel/common/+/2617070
https://android-review.googlesource.com/c/kernel/common/+/2694147

Bug: 241191475

Change-Id: If91859f558bf20c3297353bea8aadaa3ab4765e9
Signed-off-by: xieliujie <xieliujie@oppo.com>
2025-02-24 18:31:29 -08:00
Dezhi Huang bcf4630798 ANDROID: vendor_hooks: add hook to show more vendor cpu info.
Add hook to show the more information about cpu, when cat /proc/cpuinfo
 , some chip info will be appended.

Bug: 341597636
Change-Id: I4dbf7ba305a428f3dcf71e71d700a51dac8f7be0
Signed-off-by: Dezhi Huang <huangdezhi@hihonor.com>
(cherry picked from commit 08c63cde8c2bbdd5ab44c4f644422764f9b9ad14)
2025-02-24 16:58:03 -08:00
Dezhi Huang 8689d027d8 ANDROID: GKI: net: add vendor hooks for link data path
add vendor hooks to support link data path feature.
1.android_vh_dc_send_copy
For send copy pkt on the other ways
2.android_vh_dc_receive
For Drop duplicated pkt when dual connection connected

Bug: 343838581
Change-Id: I31acba1827205c366a4f54c4b940d4d8f2c21bff
Signed-off-by: Dezhi Huang <huangdezhi@hihonor.com>
(cherry picked from commit 86dd89554f8308fcd58af6156fd67ac2ac7facbf)
(cherry picked from commit f949397a1b86bdb461a14176db4a7cdc6cc63cbc)
2025-02-24 16:57:25 -08:00
Dezhi Huang 3b58573735 ANDROID: mm: create vendor hooks for page alloc
Add vendor hook inside of get_page_from_freelist() to check
and modify the watermark in some special situations.
Additional page flag bit will be set for future identification.

Separately, a vendor hook inside of page_add_new_anon_rmap()
is added to set the referenced bit in some situations, e.g.
if the special bit in the page flag mentioned before is set,
we will give this page one more chance before it gets reclaimed.

Bug: 279793368
Bug: 336900791

Change-Id: I363853a050a87201f6f368ccc580485dddd6c6b6
Signed-off-by: Dezhi Huang <huangdezhi@hihonor.com>
Signed-off-by: huzhanyuan <huzhanyuan@oppo.com>
(cherry picked from commit 49fa9c5a7e11922caa132a0d014b46b7a72f10d3)
2025-02-21 08:23:08 -08:00
Sooyong Suk 5f63d051ce ANDROID: mm: add vendor hooks in madvise for swap entry
Add vendor hooks in madvise for swap entry
- android_vh_madvise_pageout_swap_entry
- android_vh_madvise_swapin_walk_pmd_entry
- android_vh_process_madvise_end

removed android_vh_madvise_pageout_swap_entry()
renamed android_vh_process_madvise()

Bug: 284059805

Change-Id: Ic389244e343737a583286c20cadb6774efd8890c
Signed-off-by: Sooyong Suk <s.suk@samsung.com>
(cherry picked from commit 7adccac4c2778efee2a6683f360bf7e685931cf4)
2025-02-20 11:48:59 -08:00
Sooyong Suk 1808855fbf ANDROID: mm: add vendor hook in zs_shrinker
Add vendor hook to adjust zs_shrinker frequency.

Bug: 351175506
Change-Id: I1bcdf2df605a08b57546e5e3e3303cb2f10cb043
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
2025-02-20 11:04:16 -08:00
Sooyong Suk 17fcda65fd ANDROID: dma-heap: add vendor hook for dma heap alloc
Add start/end tracepoints around the allocate dma_heap_op call.

Bug: 351175506
Change-Id: Iaff719c6b7a64ac05236990e1194f51cbb10448b
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
2025-02-19 13:00:12 -08:00
Sooyong Suk ce2b5c7bca ANDROID: mm: add vendor hook for page_cache_readahead and filemap_fault
Add a vendor hook for start/end of page_cache_readahead and filemap_fault.

Bug: 351175506
Change-Id: Ie00ff34d48db7ef85520576af8986c95d841112e
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
2025-02-19 13:00:12 -08:00
Sooyong Suk 6579112b58 ANDROID: page_alloc: add new vendor hook to try alloc pages with gfp
Add new vendor hook to get pages with gfp from vendor implemented pool.
Vendor hook trace_android_rvh_try_alloc_pages() was previously added via
https://android-review.googlesource.com/c/kernel/common/+/3184382.

But there were missing gfp_t in the commit, which is needed for
page allocation. So add a new vendor hook with gfp.

Bug: 351175506
Change-Id: I64b382b8d6d528d58146f32ebabe2883234f2653
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
2025-02-19 13:00:12 -08:00
Sooyong Suk c2700380df ANDROID: mm: add vendor hook in fault and read file
Add a vendor hook to notify vendor module fault and read events.

Bug: 351175506
Change-Id: I4c46e9e00aa5f5555fd42a6b0815563497658b34
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
2025-02-19 13:00:12 -08:00
Sooyong Suk 3840257b59 ANDROID: mm: add vendor hook to skip split large folio
Add vendor hook to skip split large folio
This merges changes in commit
https://android-review.googlesource.com/c/kernel/common/+/3196190,
which is to add same vendor hook.

Bug: 351175506
Change-Id: Ibf8303215bfe23ee8d7f3c91aceffcb218c9f9ff
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
2025-02-19 13:00:12 -08:00
Sooyong Suk c174d7f80c ANDROID: page_alloc: add vendor hook to bypass rest of __free_pages_ok
Add a vendor hook to let vendor module to take pages on certain
conditions to use later instead of freeing pages directly.

Bug: 351175506
Change-Id: I067ebdd2721dcc1fe95e9ed40d1bbeddf64ac327
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
2025-02-19 13:00:12 -08:00
Sooyong Suk 01cd1509e6 ANDROID: page_alloc: add vendor hook to bypass free_pages_prepare
Add a vendor hook to bypass free_pages_prepare for those pages that have
never been used by user after free_pages_prepare. This type of pages can
be created by vendor module implementations.

Bug: 351175506
Change-Id: I5bebc47fe1be410c78924dd5392260ad0dadaa22
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
2025-02-19 13:00:12 -08:00