Add android_vh_mglru_should_abort_scan_ex() the hook is
similar to android_vh_mglru_should_abort_scan() introduced in
https://android-review.googlesource.com/c/kernel/common/+/3452054
but accepts a vendor data field to store the statistics of reclaim.
Bug: 365008739
Bug: 449066551
Bug: 451083029
Change-Id: I1c64dfebf5f9fc3766279c84b9b26fbb89a0997a
Signed-off-by: hailong <hailong.liu@oppo.com>
(cherry picked from commit c06b1f4b2109ea3fb82fe6fad37c7de01660faf1)
Add hooks for file folio reclaim. the vendor hook keep reclaimed file folios
and help direct && kswapd reclaim.
Fix Conflicts:
drivers/android/vendor_hooks.c
include/trace/hooks/mm.h
include/trace/hooks/vmscan.h
mm/vmscan.c
remove the change of mm/memcontrol.c because
https://android-review.googlesource.com/c/kernel/common/+/3603374
Bug: 407947362
Bug: 449066551
Bug: 451083029
Change-Id: I4364ae2d269e4b4b88c12823ebf66abaa4650585
Signed-off-by: Hailong Liu <hailong.liu@oppo.com>
(cherry picked from commit 43bf81d175f5480a5537205f92b632ec8e5f1787)
(cherry picked from commit 6bae5d457e35a9e3ebefdf45e8e9e8f957fd6c84)
Use per-vma locking in the shrinker's callback when reclaiming pages,
similar to the page installation logic. This minimizes contention with
unrelated vmas improving performance. The mmap_sem is still acquired if
the per-vma lock cannot be obtained.
Cc: Suren Baghdasaryan <surenb@google.com>
Suggested-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20241210143114.661252-10-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 451083029
Bug: 410746221
(cherry picked from commit 95bc2d4a9020efcd7858c91e68e9f4e842e3e8c8)
Change-Id: I11d07a05e06f837dcf68df763b2eb8cc484a8d7e
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Instead of always overriding errors with -ENOMEM, propagate the specific
error code returned by vm_insert_page(). This allows for more accurate
error logs and handling.
Cc: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20241210143114.661252-9-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 451083029
Bug: 410746221
(cherry picked from commit 978ce3ed703db86344e1df718ea0f56ec7d4dae1)
Change-Id: Ie43287aa091f2a6b05f8f9f1b3aea6e699b88455
[cmllamas: resolved trivial merge conflicts]
Signed-off-by: Carlos Llamas <cmllamas@google.com>
It is unsafe to use alloc->vma outside of the mmap_sem. Instead, add a
new boolean alloc->mapped to save the vma state (mapped or unmmaped) and
use this as a replacement for alloc->vma to validate several paths.
Using the alloc->vma caused several performance and security issues in
the past. Now that it has been replaced with either vm_lookup() or the
alloc->mapped state, we can finally remove it.
Cc: Minchan Kim <minchan@kernel.org>
Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20241210143114.661252-6-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 451083029
Bug: 410746221
(cherry picked from commit 072010abc3ad98bc20198dbe60ef13233a0a357c)
Change-Id: I25e555433793b5e3e3d8a25b732290ee8a3ba154
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Instead of pre-allocating an entire array of struct binder_lru_page in
alloc->pages, install the shrinker metadata under page->private. This
ensures the memory is allocated and released as needed alongside pages.
By converting the alloc->pages[] into an array of struct page pointers,
we can access these pages directly and only reference the shrinker
metadata where it's being used (e.g. inside the shrinker's callback).
Rename struct binder_lru_page to struct binder_shrinker_mdata to better
reflect its purpose. Add convenience functions that wrap the allocation
and freeing of pages along with their shrinker metadata.
Note I've reworked this patch to avoid using page->lru and page->index
directly, as Matthew pointed out that these are being removed [1].
Link: https://lore.kernel.org/all/ZzziucEm3np6e7a0@casper.infradead.org/ [1]
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20241210143114.661252-5-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 451083029
(cherry picked from commit f909f0308267dc49fbf122f60e1ec7ddcd1b92c7)
[cmllamas: fixed conflicts due to list_lru_del() signature]
Change-Id: I212cfbd448d265885ec63d3c97182bc012ea34e4
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Allow multiple callers to install pages simultaneously by switching the
mmap_sem from write-mode to read-mode. Races to the same PTE are handled
using get_user_pages_remote() to retrieve the already installed page.
This method significantly reduces contention in the mmap semaphore.
To ensure safety, vma_lookup() is used (instead of alloc->vma) to avoid
operating on an isolated VMA. In addition, zap_page_range_single() is
called under the alloc->mutex to avoid racing with the shrinker.
Many thanks to Barry Song who posted a similar approach [1].
Link: https://lore.kernel.org/all/20240902225009.34576-1-21cnbao@gmail.com/ [1]
Cc: David Hildenbrand <david@redhat.com>
Cc: Barry Song <v-songbaohua@oppo.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20241210143114.661252-3-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 451083029
Bug: 410746221
(cherry picked from commit d1716b4b78fb392a5514c8863e8ba287cc4580c2)
[cmllamas: fixed trivial merge conflicts]
Change-Id: If9792595bd93bdf41cd377e57d2e7213d27b0eba
Signed-off-by: Carlos Llamas <cmllamas@google.com>
This reverts commit 7710e2cca3.
In preparation for concurrent page installations, restore the original
alloc->mutex which will serialize zap_page_range_single() against page
installations in subsequent patches (instead of the mmap_sem).
Resolved trivial conflicts with commit 2c10a20f5e ("binder_alloc: Fix
sleeping function called from invalid context") and commit da0c02516c50
("mm/list_lru: simplify the list_lru walk callback function").
Cc: Mukesh Ojha <quic_mojha@quicinc.com>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20241210143114.661252-2-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 451083029
Bug: 410746221
(cherry picked from commit 8b52c7261e04f1325f47e2b173a9d4b980e8f858)
[cmllamas: fixed trivial merge conflicts]
Change-Id: I19c66787214a2863b687a3ec0ee787affeb77eb5
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Add a tracepoint to capture the same details that are being sent through
the generic netlink interface during transaction failures. This provides
a useful debugging tool to observe the events independently from the
netlink listeners.
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20250727182932.2499194-6-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 372832477
(cherry picked from commit 8a61a53b07f23ff12330086b293b6b492d35b8a0
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git char-misc-next)
Change-Id: I5185383180787d1a237b8f583306055081a9f0d9
[cmllamas: fixed missing t->is_reply]
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Add "transaction_report" to the binderfs feature list, to help userspace
determine if the "BINDER_CMD_REPORT" generic netlink api is supported by
the binder driver.
Signed-off-by: Li Li <dualli@google.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20250727182932.2499194-5-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 372832477
(cherry picked from commit f37b55ded8ed35424ebb91a4d012527071e1f601
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git char-misc-next)
Change-Id: I0793b68e6f96283d47e3d44dcc68f248495dbcb3
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Introduce a generic netlink multicast event to report binder transaction
failures to userspace. This allows subscribers to monitor these events
and take appropriate actions, such as stopping a misbehaving application
that is spamming a service with huge amount of transactions.
The multicast event contains full details of the failed transactions,
including the sender/target PIDs, payload size and specific error code.
This interface is defined using a YAML spec, from which the UAPI and
kernel headers and source are auto-generated.
Signed-off-by: Li Li <dualli@google.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20250727182932.2499194-4-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 372832477
(cherry picked from commit 63740349eba78f242bcbf60d5244d7f2b2600853
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git char-misc-next)
[cmllamas: fix missing t->is_reply, fix ABI header include issue]
Change-Id: I7013f9bba450f7ab3331dd850314a7b62af58818
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Move the allocation of 'struct binder_transaction' to the beginning of
the binder_transaction() function, along with the initialization of all
the members that are known at that time. This minor refactoring helps to
consolidate the usage of transaction information at later points.
This patch is in preparation for binder's generic netlink implementation
and no functional changes are intended.
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20250727182932.2499194-2-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 372832477
(cherry picked from commit 4afc5bf0a1849f0ed3ea1d9fd9d0e79b23a67f96
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git char-misc-next)
[cmllamas: fix minor conflicts with t->priority]
Change-Id: I588319183f1d69e3694b00341432d6d4eee0a697
Signed-off-by: Carlos Llamas <cmllamas@google.com>
the first one is the lifecycle that they are added to thread pool,
and they are released. another is that the data is readed by thread.
Bug: 333839270
Change-Id: I41d58474aa66533a2104c07aae525bf09e32df4d
Signed-off-by: Muduo Qin <muduo.qin@tcl.corp-partner.google.com>
(cherry picked from commit b98dd52b77f25f724052221c54b4e197692406e7)
Add restricted vendor hook to optimize the swap-in latency.
Rename swap_readpage_bdev_sync to swap_read_folio_bdev_sync to align
with the upstream function name.
Bug: 436973821
(cherry picked from commit 6d61bc2d2d7fcb6e4eef25e5182563b0ae79e4c3)
Change-Id: I1a2be1a309769590cb427e13762e29d8c8fa9cf6
Signed-off-by: Richard Chang <richardycc@google.com>
Along with I746f4fbc20df5cf394d7644ff2cd6f25916c9790,
it also needs to adjust check_flags.
Bug: 416087944
Bug: 436973821
Change-Id: I2871ab305963da00fcc8b0a7755bd8db7859e4c5
Signed-off-by: Minchan Kim <minchan@google.com>
(cherry picked from commit 8f5494d90cac148e269da2937456243ed2d5906f)
Signed-off-by: Richard Chang <richardycc@google.com>
A hardware exception interrupt will be routed to kernel as fiq by atf,
we need to save logs/regs info to ddr when the fiq ocurred.
Therefore, a hook point is added before the fiq handler.
Bug: 335522774
Change-Id: I18fa76425cbc39b0f895d3907475c2dfc04c247f
Signed-off-by: qiusanming <qiusanming@xiaomi.com>
(cherry picked from commit f052f87d33f9f26ae0d420503a5043fd3f42dbf8)
Fix the timestamp in front of the log is out of order when
using android_vh_logbuf with CPU core is offline.
Bug: 364443023
Change-Id: Ib37f4373d3511aaf765838bf581c84ed22992a77
Signed-off-by: Xandy.Xiong <xiongliang@xiaomi.com>
(cherry picked from commit 9b44f2fb794ccd5a17777e317bec959558d21f9e)
The destructor of AllocationInfo could potentially sleep. Don't call it
from reservation_commit.
Reported-by: Gary Guo <gary@garyguo.net>
Fixes: dac7c66bc9 ("ANDROID: rust_binder: move Rust Binder in preparation for GKI module")
Change-Id: Iea4d675c7b9db51019739c0b462b9108f7fecf0b
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Avoid making order 3 allocations with kmalloc. Using kvmalloc will help
avoid OOM conditions.
Bug: 350907206
Change-Id: Ib1e8c113ac2cbe6b46938e2541ff76efc1f9d111
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
The main function is to check whether the corresponding IOMMU buffer
is unmapped when dmabuf is released, so as to avoid memory coverage
caused by IOMMU.
Bug: 438090847
Change-Id: I56ae3f0994cd4f3d24494b7972e4d89d0f004da8
Signed-off-by: Gaofeng Sheng <gaofeng.sheng@unisoc.com>
(cherry picked from commit 8879650556ed747baf5a4d3037d687a76ccb986f)
add hook to modify allowable THP orders based on vma and current
Bug: 438090847
Change-Id: I10c61d1ed73c6f66d1eb50252bdb5223aceb1051
Signed-off-by: yan chang <changyan1@xiaomi.com>
This hook is used to dynamic modify:
1.gfp_mask, which control behavior for allocation.
2.orders, which control highest order to try alloc folio.
3.order, which need assign `order = highest_order(orders);`
Bug: 438090847
Change-Id: Id2e89a2c674acb7bea6867cdb9f84163c266d7db
Signed-off-by: chunpeng li <lichunpeng@xiaomi.com>
Signed-off-by: yan chang <changyan1@xiaomi.com>
Rust Binder cleanup is reworked to match the order in which C Binder
cleans up things. A few notes on the changes:
* Actually dropping thread objects is done at the very end because they
contain a call to synchronize_rcu() which is slow. This ensures that
death notifications are sent without waiting for those calls. This
avoids failures in rustBinderTest. (The test is already flaky, but
this extra sleep makes the flake much more likely to happen.)
* We now free refs on remote nodes in release explicitly. Previously
that only happened implicitly when everything keeping the ref alive
has been dropped. To avoid spurious warnings from this, the warning
print about dropping a ref that doesn't exist is only printed if the
process is alive.
Bug: 431914626
Change-Id: I3d1f4f15ffac7587d1bb0113a41330b2aea69b3d
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Add a hook for custom vendor modules to trace wp_page_reuse behavior,
This allows for monitoring of page reuse events and custom handling.
Bug: 437042547
Change-Id: I0faf068acdff2f964884d3081c35d85abd5a19fa
Signed-off-by: Tangquan Zheng <zhengtangquan@oppo.com>
Include a restricted vendor hook to allow vendor modules to modify
thermal updates under scmi notifications.
Bug: 436290872
Change-Id: I57e33ea44b66986058008ac83737524a8c31aec0
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
android_vh_mm_customize_longterm_pinnable - This hook allows vendors to
customize some special folios that are not migrated. They should not be
migrated to avoid application lags.
android_vh_mm_do_madvise_bypass - This hook allows vendors to customize
some madvise behaviors so that some madvise requests can be completed
quickly in certain scenarios.
android_vh_mm_migrate_one_page - This hook allows vendors to track
certain folios that are being migrated.
android_vh_mm_remove_migration_pte_bypass - This hook is used to
properly handle the migration of the aforementioned special folio.
android_vh_mm_split_huge_page_bypass - This hook is used in certain
scenarios where large folios should not be split to avoid the overhead
caused by splitting.
android_vh_mm_try_split_folio_bypass - This hook is used to skip
splitting large folios during migration in certain scenarios.
Bug: 431672372
Change-Id: I3c3580651e330dc8cfa6fa6f7a4f85fba1ba9807
Signed-off-by: Pengfei Li <pengfei.kernel@vivo.corp-partner.google.com>
The following hooks are added for memory reclaim tuning:
android_vh_mm_isolate_priv_lru - This hook is used to properly handle certain
folios when they are reclaimed.
android_vh_mm_customize_file_is_tiny - For a specific process, we want only
anonymous pages to be reclaimed. This hook allows vendors to modify the value
of file_is_tiny to affect the reclaim behavior.
android_vh_mm_customize_pgdat_balanced - When there are multiple zones, it is
not always reasonable to perform indirect reclaim only when all zones do not
meet the watermark. This hook allows vendors to customize pgdat_balanced to use
their own strategy to determine whether to perform and stop indirect collection.
android_vh_mm_customize_reclaim_idx - When there are multiple zones, vendors use
this hook to customize which zones can be reclaimed.
android_vh_mm_customize_zone_can_compact - When there are multiple zones, vendors
use this hook to customize which zones can be compacted.
Bug: 431672372
Change-Id: I860c2665088753a5c3b6d6dfeeb25a82aeefc8af
Signed-off-by: Pengfei Li <pengfei.kernel@vivo.corp-partner.google.com>
The following hooks are added for memory allocation tuning:
android_vh_mm_customize_alloc_anon_thp - When allocating anonymous folios, this
hook will set different orders based on the importance of the processes. In
particular, some critical processes will allocate folios directly in this hook
to speed up memory allocation.
android_vh_mm_customize_ac - In __alloc_pages_noprof, this hook provides the
ability to modify alloc_context and alloc_flags to accommodate processes of
different importance.
android_vh_mm_customize_rmqueue - In rmqueue, this hook provides the ability to
modify alloc_flags and migratetype, which will be used by vendors to customize
alloc_flags and migratetype to speed up memory allocation.
android_vh_mm_customize_suitable_zone - For some specific gfp_mask and order
requests, this hook is used to skip zones that should not be allocated, and for
some critical processes, the wmark limit is skipped and jumps to try_this_zone
for allocation to prevent it from being stuck.
android_vh_mm_customize_wmark_ok - Vendors use this hook to customize the return
value of wmark_ok based on different payloads.
android_vh_mm_customize_zone_max_order - This hook is used to limit the maximum
order allowed for special zone. It reduces a lot of unnecessary repeated merges
and splits (because large orders are rarely allocated).
android_vh_mm_customize_zone_pageset - This hook allows vendors to customize
the high and batch of pagesets.
Bug: 431730501
Bug: 431672372
Change-Id: I65d6b2cd63688291e6360597bc2a4157fa228df7
Signed-off-by: Pengfei Li <pengfei.kernel@vivo.corp-partner.google.com>
A vendor hook to bypass free_one_page() via __free_pages_ok() was added
via https://android-review.googlesource.com/c/kernel/common/+/3458032 for
vendor modules to hook pages on certain conditions to use later instead
of freeing pages directly.
In kernel v6.12, for same purpose, free_unref_folios() and free_unref_page()
path also needs same vendor hook to bypass free_one_page().
Bug: 410432482
Change-Id: I1863eb497eee796903b483a3a9f8808ab372b475
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
Gcma put page is only allowing workingset pages by default to increase
cleancache hit ratio. On my device, the utilization ratio of the gcma area
as cached pages is really low like almost zero. So I'd like to add a vendor
hook to allow non-workingset pages when gcma usage is low.
Bug: 433652944
Change-Id: I43a3900db416b2af6758d8b8905299eba0e38f39
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
Add a vendor hook `android_vh_swap_bio_charge` in swap read path
to allow vendors to monitor behavior when a swap bio
is submitted.
Bug: 433890875
Change-Id: I742978c7cb5c7d678d585b49e3466920f99e4fba
Signed-off-by: Dongdong zhang <zhangdongdong5@xiaomi.com>
Since upstream commit 617f3ef951 ("locking/rwsem: Remove
reader optimistic spinning"), vendors have seen increased
contention and blocking on rwsems.
There are attempts to actively fix this upstream:
https://lore.kernel.org/lkml/20240406081126.8030-1-bongkyu7.kim@samsung.com/
But in the meantime, provide vendorhooks so that vendors can
implement their own optimistic spin routine. In doing so,
vendors see improvements in cold launch times on important apps.
Bug: 433638448
Bug: 331742151
Change-Id: I7466413de9ee1293e86f73880931235d7a9142ac
Signed-off-by: xieliujie <xieliujie@oppo.com>
[jstultz: Rewrote commit message]
Signed-off-by: John Stultz <jstultz@google.com>
(cherry picked from commit abe0af2abe51fae4fb072c8d7124aaa37f1da574)
This fixes some test failures in rustBinderTest caused by commit
f06dd0cd35 ("ANDROID: rust_binder: release threads before refs").
Honestly I'm not entirely sure why. Note that this reverses that commit,
and fixes the resulting logspam by instead moving cleanup of allocated
buffers to the end of process release.
Bug: 431914626
Change-Id: I1f7faa486f86cef7fbe37ad87b720573a5e05ee5
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Cleancache put page operation is slower than just dropping file pages.
So, I'd like to restrict gcma store page on some conditions.
For example, direct reclaim contexts can bypass cleancache operation
for better reclaim performance.
Bug: 410432482
Change-Id: Ifc38b9b2912d1832dac5d2003ebd042683f78a1f
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
Rust Binder currently returns an error when death notifications are
registered or removed illegally. This causes tests that use the kernel
interface incorrectly to fail. To have the same behavior as C Binder,
adjust the death notification logic to print but otherwise ignore these
error conditions.
Bug: 430659969
Change-Id: Ia11aebea74ae1441fc48e40cbf43fae56bf3be54
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
The C Binder driver uses binder_uintptr_t for the cookie, which always
corresponds to a 64-bit integer.
Bug: 430659969
Change-Id: I6a83d0959fa97f994fb3180351329a4bf843110d
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
EROFS supports large folios on kernel-6.12 which enable high order
allocation with direct_reclaim flags. This might increase the latency
on UX task with filemap_fault(). Add a vendor hook here to bypass
unnecessary allocation in certain scenarios.
Bug: 430753566
Change-Id: I0f11b059a06d1e839aed51dc9b41f1a312eec048
Signed-off-by: Hailong Liu <hailong.liu@oppo.com>
Add the hook that vendor can design and bypass the suspend/resume.
When the bypass is set, skip the orignal suspend/resume methods.
In mobile, a co-processor can be used with USB audio, and ACPU may
be able to sleep in such condition to improve power consumption.
We will need vendor hook to support this.
Bug: 329345852
Bug: 302982919
Bug: 347134330
Bug: 408097873
Signed-off-by: Puma Hsu <pumahsu@google.com>
Change-Id: I91a9500407939e9c4e0c1fef1f7ccc232d4322c1
(cherry picked from commit 98085b5dd8afd1ec65500eb091d061a3fee21b84)
(cherry picked from commit 358b59f1bce213fe1d83e09ae2e1fba718682e4a)
(cherry picked from commit 41292928f934c3f947f881ea0c51e61200c84d8d)
(cherry picked from commit 26f9f515d1b98fb93c8c797bdedacf05ada5a75a)
Signed-off-by: Hongseock Kim <hongpooh.kim@samsung.com>
Commit 5da94eacba ("ANDROID: rust_binder: print and avoid underflow
with invalid refcnt") added a print when decrementing the refcount if
the ref doesn't exist. This revealed that this sometimes happens inside
thread.release() because the refs were cleared before releasing the
threads. In principle this error is harmless, but to avoid printing this
error, release threads before clearing refs.
Bug: 430660253
Change-Id: I9ceb71ca831f5bb58193e12951245bab19ea4fa2
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Add Android kernel vendor hooks before and after VM demand paging to
enable calls to vendor modules for memory protection. This enhancement
ensures that memory protection mechanisms are properly invoked during
the demand paging process, improving the overall security and
stability of the system.
This feature is particularly important for systems that rely on
multiple IOMMU components to manage memory protection, ensuring that
all necessary preparation are properly applied during the demand
paging process.
Bug: 430175928
Signed-off-by: Willix Yeh <chi-shen.yeh@mediatek.com>
Signed-off-by: Liju Chen <liju-clr.chen@mediatek.com>
Change-Id: Iff019cc82d4bda852a7b72405ebe6026c893b26d
In order to implement our scheduling tuning policy in certain cases, we
need to initialize the variables that we have defined in the
user_struct. To achieve this, we will add a vendor hook to user.c at
alloc_uid, which will ensure that our own logic is executed during the
initialization of the user_struct.
Bug: 425550656
Bug: 339371220
Bug: 187458531
Signed-off-by: heshuai1 <heshuai1@xiaomi.com>
Change-Id: I078484aac2c3d396aba5971d6d0f491652f3781c
(cherry picked from commit c9b8fa644f45e9c99da85d8947f6c7e06771f205)
(cherry picked from commit 9ac0923ef565e4de4e1f35edcba6fcb7e45948c9)
(cherry picked from commit f0b0ff9fdb8ea1ea56fc7e3c556efdcfa93ec763)
[jstultz: Add magic ANDROID_KABI_DECLONLY incantations to try to quiet
CRC errors, then split those out into a separate patch]
Signed-off-by: John Stultz <jstultz@google.com>
Similar to commit c21a80ca06 ("binder: fix test regression due to
sender_euid change").
Bug: 429060661
Change-Id: I3f833e5b01485b39b382a5d78fe7f22822ca7491
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
We landed the MM series as FROMLIST, and in the version of the series
that landed upstream the VmAreaNew type had been renamed to VmaNew.
Thus, update the naming in Rust Binder.
Bug: 429146594
Change-Id: I244decf4fa7e0ee9077a5f1a2a82f409eccde290
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Because we are backporting commit e0020ba6cbcb ("rust: add
PidNamespace"), it is neccesary to update Rust Binder to use the new
tgid_nr_ns() method for getting the task's pid, as that commit deleted
pid_in_current_ns().
Bug: 429146594
Change-Id: I3acd7e3f1fee2957d5663208614667220e09dfd5
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Currently the binder_logs/procs/pid file is removed in the deferred
release callback that runs on the workqueue, which means that it may run
after the underlying filesystem is unmounted. However, dentries must be
removed before the filesystem goes away, so remove it explicitly when
scheduling the deferred release callback.
Bug: 426116428
Change-Id: I77db9261711989f8d4cd4c3a22903ff83a3fa9b7
Signed-off-by: Alice Ryhl <aliceryhl@google.com>