Commit Graph

20 Commits

Author SHA1 Message Date
Minchan Kim
7df45e50a5 ANDROID: vendor hook to control blk_plug for memory reclaim
Add vendor hook to contorl blk plugging.

Bug: 255471591
Bug: 238728493
Change-Id: I96b73cec14f0d2fea46a4828526e6ae5aa5c71b7
Signed-off-by: Minchan Kim <minchan@google.com>
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit a17e132ec4f290621666311e73f43202706d2743)
2023-01-13 18:43:29 +00:00
Minchan Kim
ba005d6032 ANDROID: vendor hook to control bh_lru and lru_cache_disable
Add vendor hook for bh_lru and lru_cache_disable

Bug: 238728493
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: I81bfad317cf6e8633186ebb3238644306d7a102d
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit 74e2ea264cd1895c493b9008b62bfea98dacf3f6)
2023-01-13 18:43:29 +00:00
Minchan Kim
243f54dd3a ANDROID: vendor hook for TLB batching control
Add vendor hook for flushing TLB batching in zap_pte_range.

Merged CL 232bdcbd660b1129b7d8d0de25a563b476eeb522:
ANDROID: pass argument in zap_pte_range vendor hooks

Bug: 238728493
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: If2de5f070dd7b76624961f5a91440bf69a99ca2d
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit d257ef6764f228145d0fca24998162809bb5b9f7)
2023-01-13 18:43:29 +00:00
Minchan Kim
bb6ab2be93 ANDROID: vendor hook to control pagevec flush
The pagevec batching causes lru_add_drain_all which is too expensive
sometimes. This patch adds a new vendor hook to drain the pagevec
immediately depending on the page's type.

Bug: 251881967
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: Id17e14e69197993ddad511a40c96e51674c02834
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit 2f8253b7e6e563cc19cffa120c72f6f528664103)
2023-01-13 18:43:29 +00:00
Robin Hsu
1eeadb47e0 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: local kernel build test
Signed-off-by: Robin Hsu <robinhsu@google.com>
Change-Id: I3d95434bf49b37199056dc9ddfc36a59a7de17b7
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit 13b6bd38bb1f43bfffdb08c8f3a4a20d36ccd670)
2023-01-13 18:43:29 +00:00
Minchan Kim
e3f396c2d4 ANDROID: add vendor_hook to control CMA allocation ratio
CMA first allocation policy for movable makes CMA(Upstream doesn't)
area always full. It's good for memory efficiency since it could use
up CMA available memory most of time. However, it could cause
cma_alloc slow since it causes a lot page migration all the time.

Let's add vendor hook for someone who want to restore CMA allocation
policy to upstream so they will see less page migration in cma_alloc.

If the vendor_hook returns false, the rmqueue_bulk return 0 without
filling pcp->lists so get_populated_pcp_list will return NULL.
Once get_populated_pcp_list returns NULL, __rmqueue_pcplist will retry
the page allocation with original migratetype(currently, original
migratetype couldn't be MIGRATE_CMA) so the retrial will find
available pages from !MIGRATE_CMA free list.

Bug: 231978523
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: Ia031d9bc6f34085b892a8d9923bf5b9b1794f94a
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit 0ca85e35bf5b4a7ff08f00a060c83e4a82380b64)
2023-01-13 18:43:29 +00:00
Minchan Kim
1b2de5aa2d 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
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit c6e85ea56b)
2023-01-05 02:16:50 +00:00
Todd Kjos
b3efd2ad71 ANDROID: remove inclusions from hook definition headers
To avoid changing the visibiliy of data types when including
hook definition headers remove header file inclusions from
the hook definition header files.

Instead, the hook definition headers should just have forward
declarations that don't require full definition.

To provide full definitions of the types for the KMI, the
headers that define the types should be included by the
source file that instantiates the hooks - normally
vendor_hooks.c.

Bug: 233047575
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: Iaaa1a6f45a356569c04ad2fea0b1514e0454f041
2022-09-08 23:24:37 +00:00
Liujie Xie
7af5027889 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
(cherry picked from commit 1cdcf76b15)
2022-07-19 12:47:38 +00:00
Giuliano Procida
76ed7e5d56 ANDROID: GKI: use internal type definitions in vendor hooks
This change is intended to reduce the chance of a missed ABI break
involving vendor hooks.

The following types are now fully defined in ABI XML.

* `struct binder_transaction`
* `struct binder_thread`
* `struct binder_proc`
* `struct printk_ringbuffer`
* `struct printk_record`

symbol '__alloc_pages' changed
  CRC changed from 0x6497cbd to 0x230fd8e5

symbol '__find_vma' changed
  CRC changed from 0xf11b619f to 0xb0069a61

symbol '__free_pages' changed
  CRC changed from 0xba5eeb68 to 0xdc394265

... 195 omitted; 198 symbols have only CRC changes

Bug: 233047575
Change-Id: I807227f6161f0a44ec3657dc8cdb8a3fdffc40b3
Signed-off-by: Giuliano Procida <gprocida@google.com>
2022-07-19 12:47:36 +00:00
Liujie Xie
5fdfed7d78 ANDROID: vendor_hooks: Add hooks for memory when debug
Add vendors hooks for recording memory used

Bug: 182443489
Bug: 234407991
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I62d8bb2b6650d8b187b433f97eb833ef0b784df1
2022-07-19 03:52:51 +00:00
Jiewen Wang
ecbd315a64 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>
(cherry picked from commit 955f917251)
2022-07-19 03:52:51 +00:00
Jiewen Wang
e846635d85 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>
(cherry picked from commit 878e0caa77)
2022-07-19 03:52:51 +00:00
Peifeng Li
998b760798 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
Bug: 234405962
Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: Ifdeeed9f8934d87671ec3fa6787a02675b993082
2022-07-19 03:52:39 +00:00
Peifeng Li
a82943cdfb 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
Bug: 234405962
Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: I0a82f668cf985ad5344d666c0c6372a7e61c3798
2022-07-19 03:52:39 +00:00
Liujie Xie
d1ba6f2de7 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
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I0805241f81e0a94afcf62c98e97cff125d4061e2
2022-07-19 03:52:39 +00:00
Saravana Kannan
0ef21e1c1a ANDROID: vendor_hooks: Reduce pointless modversions CRC churn
When vendor hooks are added to a file that previously didn't have any
vendor hooks, we end up indirectly including linux/tracepoint.h.  This
causes some data types that used to be opaque (forward declared) to the
code to become visible to the code.

Modversions correctly catches this change in visibility, but we don't
really care about the data types made visible when linux/tracepoint.h is
included. So, hide this from modversions in the central vendor_hooks.h file
instead of having to fix this on a case by case basis.

This change itself will cause a one time CRC breakage/churn because it's
fixing the existing vendor hook headers, but should reduce unnecessary CRC
churns in the future.

To avoid future pointless CRC churn, vendor hook header files that include
vendor_hooks.h should not include linux/tracepoint.h directly.

Bug: 227513263
Bug: 226140073
Signed-off-by: Saravana Kannan <saravanak@google.com>
Change-Id: Ia88e6af11dd94fe475c464eb30a6e5e1e24c938b
2022-04-06 08:31:36 -07:00
Prakash Gupta
4d7fc7aaec 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>
Signed-off-by: Sudarshan Rajagopalan <quic_sudaraja@quicinc.com>
2022-01-25 23:20:59 +00:00
Todd Kjos
9e0cf0e90d 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:44:33 +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