Commit Graph

30 Commits

Author SHA1 Message Date
Bing Han
f7c932399e ANDROID: vendor_hook: Add hook in handle_pte_fault()
android_vh_handle_pte_fault_end: after handle_pte_fault, update
the information that whether this page need to be reclaimed to
a swap location.

Bug: 234214858
Signed-off-by: Bing Han <bing.han@transsion.com>
Change-Id: I0ceb02422fc858ed96fbb47e220bf96bdc8fa68c
2022-06-30 03:00:23 +00:00
Bing Han
50148ce249 ANDROID: vendor_hook: Add hook in do_swap_page()
android_vh_swapin_add_anon_rmap: after add pte mapping to an anonymous
page durning do_swap_page, update the status that whether this page
need to be reclaimed to a swap location, according to the information
of vm_fault.

Bug: 234214858
Signed-off-by: Bing Han <bing.han@transsion.com>
Change-Id: I8a2d603102c315323817e6c9366db9b0da878344
2022-06-30 03:00:23 +00:00
Bing Han
9d4b553252 ANDROID: vendor_hook: Add hook in wp_page_copy()
android_vh_cow_user_page: when copy a page to a new page, set the
status that whether the new page should be reclaimed to a specified
swap location, according to the information of vm_fault.

Bug: 234214858
Signed-off-by: Bing Han <bing.han@transsion.com>
Change-Id: Ie445c7b034ca176ec1e8fd1cd67c88581bf9ddf4
2022-06-30 03:00:23 +00:00
Bing Han
e3f469befb ANDROID: vendor_hooks: Add hooks to madvise_cold_or_pageout_pte_range()
Provide a vendor hook android_vh_page_isolated_for_reclaim to
process whether the page should be reclaimed to a specified
swap(i.e., the expanded memory).
This strategy will take into account the state of the current
process/application, resource usage, and other information.

Bug: 234214858
Signed-off-by: Bing Han <bing.han@transsion.com>
Change-Id: Id80a377c87bea13922e7b23963b050ab37ba0cb0
2022-06-30 03:00:23 +00:00
Giuliano Procida
1590a0e8e1 ANDROID: GKI: include more type definitions in vendor hooks
The following types are now fully defined in ABI XML.

* `struct binder_transaction_data`
* `struct blk_mq_alloc_data`
* `struct media_link_desc`
* `struct packet_type`
* `struct printk_record`
* `struct printk_ringbuffer`

Bug: 233047575
Change-Id: Ib7a096c937cfa9facca89b8a26edd2f4b00416a1
Signed-off-by: Giuliano Procida <gprocida@google.com>
2022-06-23 18:21:44 +00:00
liang zhang
f06daa5a0b 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
Change-Id: I91656bde5e616e181fd7557554d55e7ce1858136
Signed-off-by: liang zhang <liang.zhang@transsion.com>
2022-04-24 10:53:17 +00:00
Peifeng Li
cb7c1a4c78 ANDROID: vendor_hooks: Add hooks to for free_unref_page_commit
Provide a vendor hook to skip cma-pages to add in pcplist when
free_unref_page_commit.

The patch is revelant to skip drain_all_pages in alloc_contig_range,
the revelant hooks is android_vh_cma_drain_all_pages_bypass
which is to avoid to delay in drain pcppages when drain_all_pages.

In most case, pcp->high is small so that free-pages with other mt_types
can also fill with pcplist full.

Bug: 224732340
Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: Ifdeeed9f8934d87671ec3fa6787a02675b993082
2022-03-30 15:56:32 +00:00
Peifeng Li
a2485b8abd ANDROID: vendor_hooks: Add hooks to for alloc_contig_range
Provide a vendor hook to allow drain_all_pages to be skipped
during alloc_contig_range in some cases to avoid delays caused by
it in cases when the benefits of draining pcp lists are known
to be small.

Bug: 224732340
Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: I0a82f668cf985ad5344d666c0c6372a7e61c3798
2022-03-30 15:56:25 +00:00
Liujie Xie
ebbf267fc0 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
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I0805241f81e0a94afcf62c98e97cff125d4061e2
2022-03-04 00:43:37 +00:00
Greg Kroah-Hartman
e09000ee19 Revert half of "ANDROID: vendor_hooks: Add hooks for memory when debug"
This reverts parts of commit 24149445ad.

The hooks android_vh_alloc_pages_slowpath,
android_vh_print_slabinfo_header, and android_vh_cache_show are not used
by any vendor, so remove them 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: 182443489
Cc: Liujie Xie <xieliujie@oppo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I63621110c0c38b7e5d5e5e6f85c513bf00ecc00b
2022-01-21 13:11:10 +01:00
Chris Goldsworthy
84fc3abca0 ANDROID: dma-contiguous: Add tracehook to allow subpage allocations in dma_alloc_contiguous
Add a tracehook to allow callers into dma_alloc_contiguous() to make
use of the built-in CMA area if the caller has addressing limitations;
this provides a means of allocating from memory whose bounds are
restricted to the lower 4 GB of memory, without having to enable DMA32
(assuming the default CMA area has been restricted to the appropriate
address ranges).

Leaf changes summary: 1 artifact changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 1 Added variable

1 Added variable:

  [A] 'tracepoint __tracepoint_android_vh_subpage_dma_contig_alloc'

Bug: 199917449
Change-Id: Ia86fb416376bca231405b06ab27b0674c8fe3e14
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
2021-12-17 02:31:49 -08:00
Jiewen Wang
955f917251 ANDROID: vendor_hooks: Add hook in try_to_unmap_one()
Add hook in try_to_unmap_one() to trace this function for debug memory
swap bugs.

Bug: 198385827
Change-Id: I1fdbe60e09bb491b949e06a07133710453ecca03
Signed-off-by: Jiewen Wang <jiewen.wang@vivo.com>
2021-09-06 17:00:04 +08:00
Jiewen Wang
878e0caa77 ANDROID: vendor_hooks: Add hook in mmap_region()
Add hook in mmap_region() to record the vma and address information
of monitored processes.

Bug: 198385827
Change-Id: I0bde29113b47ca7f4a9f5d42a54188e791ca3b7e
Signed-off-by: Jiewen Wang <jiewen.wang@vivo.com>
2021-09-06 16:51:38 +08:00
Liujie Xie
94fbab9d6c ANDROID: vendor_hooks: Add hook in kmalloc_slab()
Add hook in kmalloc_slab() for debug kmalloc slab memory leak.

Bug: 197614797

Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I402a9f968f2bf1e75daa461c05a53a8fabf70028
2021-09-03 00:17:50 +00:00
Liujie Xie
1cdcf76b15 ANDROID: vendor_hooks: add hooks in mem_cgroup subsystem
Add hooks to tune memory policy based on mem_cgroup.

Bug: 192052083

Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: Ica1a5409eed86fbd466edd2c7557f94972a40175
2021-07-09 17:10:05 +00:00
Liangliang Li
444a0b7752 ANDROID: mm: add vendor hook for vmpressure
Add vendor hook for bypass vmpressure accounting when doing oem's
custom memory reclaim.

Bug: 191534577

Change-Id: I0c2263e03943596312aa6b01cf8506f2ae87213e
Signed-off-by: Liangliang Li <liliangliang@vivo.com>
2021-07-07 23:23:10 +00:00
xieliujie
0a24affb86 ANDROID: vendor_hooks: modify the function name
int the commit: https://android-review.googlesource.com/c/kernel/common/+/1699406/
When we build  our vendor driver, report two errors:
1) Symbol too long "trace_android_vh_get_unmapped_area_from_anti_fragment_pool"
2) Symbol too long "trace_android_vh_get_unmapped_area_include_reserved_zone"

So, I shorten the function names:
android_vh_get_unmapped_area_from_anti_fragment_pool  -->  android_vh_get_from_fragment_pool
android_vh_get_unmapped_area_include_reserved_zone    -->  android_vh_include_reserved_zone

Bug: 191439466
Signed-off-by: xieliujie <xieliujie@oppo.com>
Change-Id: Icee4faa24df4fe1fc29434cd205c4dea82b4fba5
2021-07-02 20:42:14 +00:00
Liujie Xie
7d216e2512 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: 8bc6337823 ("ANDROID: vendor_hooks: add hooks for slab memory leak debugging")
Bug: 184928480
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I74c50c02cfb4ebbf3e9fecdf125e76946ff4e7d1
2021-07-01 00:52:06 +00:00
Liangliang Li
da33f6fa6c ANDROID: mm: Add hooks to filemap_fault for oem's optimization
Add vendor_hooks to filemap_fault to cache page for oem's optimization.
Save the page for next time retry when VM_FAULT_RETRY returned.

Add ANDROID_OEM_DATA to vm_fault to save the page.

Bug: 188891314
Change-Id: Ibfc9ec950c3360e6f6ccb9546cab0acd89e5d316
Signed-off-by: Liangliang Li <liliangliang@vivo.com>
2021-06-17 14:16:47 -07:00
Prakash Gupta
72488b3be4 ANDROID: mm, oom: add vendor hook to prevent oom panic
In some cases we would like to bypass oom panic and give the system more
time to cleanup memory. Add vendor hook to allow skipping the oom panic.

Bug: 186875166
Change-Id: I64e74b2c013d6f18d74504777c6559d9ae07e008
Signed-off-by: Prakash Gupta <guptap@codeaurora.org>
2021-05-24 23:21:17 +05:30
Liujie Xie
8bc6337823 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

Change-Id: I6897a6a98d4eaaea492673cefd4111a7ba741940
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
2021-05-21 13:17:08 -07:00
Yang Yang
1b6f2f6e29 ANDROID: vendor_hooks: add hook to balance_dirty_pages()
Add vendor hook in order to track which process cause dirty page write
back pressure.

Bug: 188096764
Change-Id: I890299c97d7a8cf791f20d16d8d53b4615679b9e
Signed-off-by: Yang Yang <yang.yang@vivo.com>
2021-05-20 19:38:42 +00:00
xieliujie
dc5241048f ANDROID: vendor_hooks: Add hooks for reducing virtual address fragmentation
When running 32-bit apps for a long time, virtual address becomes fragmented which can lead to allocation failures when a large virtually-contiguous area is requested.
Add hooks to implement pools to cluster together small-sized virtual address mappings.
Add hooks to implement reserved virtual address zone with usage restrictions controlled by vendor hooks.
These hooks help in controlling virtual address space fragmentation.

Bug: 187259935

Signed-off-by: xieliujie <xieliujie@oppo.com>
Change-Id: I48c057041f9c7b8c5ab0af305f0cd87a039d0447
2021-05-20 19:36:17 +00:00
Elliot Berman
128b8a7ad2 ANDROID: mm: cma: Add forward definition of cma in vendor hook
When compiling usermode linux, following error comes:

include/trace/hooks/mm.h:29:35: warning: 'struct cma' declared inside
parameter list

Add forward declaration of struct cma in trace/hooks/mm.h

Bug: 184732692
Fixes: commit c6e85ea56b ("ANDROID: mm: cma: add vendor hoook in
cma_alloc()")
Change-Id: I650a5b2d7f96a4ecb2d338e3b46abed5ea98459f
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2021-04-08 05:36:44 +00:00
Minchan Kim
c6e85ea56b ANDROID: mm: cma: add vendor hoook in cma_alloc()
Add vendor hook for cma_alloc latency measuring.

Bug: 177231781
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: Ia2dbb26454bd8f03489389b29b9a6c939d3c2bbb
2021-04-06 20:01:19 +00:00
Liujie Xie
24149445ad ANDROID: vendor_hooks: Add hooks for memory when debug
Add vendors hooks for recording memory used

Bug: 182443489
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I62d8bb2b6650d8b187b433f97eb833ef0b784df1
2021-03-19 04:54:07 +00:00
Chiawei Wang
db158b4ae0 ANDROID: mm: Add vendor hook in pagecache_get_page()
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
2021-02-19 17:59:52 +00:00
Chiawei Wang
369de37804 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
2021-02-19 17:59:30 +00:00
Todd Kjos
10fc8b2584 ANDROID: simplify vendor hook definitions
Remove macro versions of hooks that are no longer needed. The
macro versions are still needed when the _rcuidle version
of the hook is used (as in include/trace/hooks/debug.h).

Bug: 177416721
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I4b50447e9a922ed038663d1459d7622dab30ffbb
2021-01-27 09:45:26 +00:00
Chris Goldsworthy
62e32cf8f3 ANDROID: mm: Create vendor hooks to control ZONE_MOVABLE allocations
Create a vendor hook inside of gfp_zone() to modify which allocations
get to enter ZONE_MOVABLE, by zeroing out __GFP_HIGHMEM inside of the
trace hook based on certain conditions.

Separately, create separate trace hooks in the swap-in and readahead
paths to affect the behavior of the tracehook in gfp_zone().

Bug: 158645321
Change-Id: I4a4f0b724267ee120a1e5661f6da5d43d7ef6fc6
Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org>
2020-12-01 18:07:54 +00:00