Steven Moreland | 54fa6c7 | 2025-01-28 01:02:15 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2025 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
| 19 | namespace android::binder { |
| 20 | |
| 21 | /** |
| 22 | * See also BINDER_VM_SIZE. In kernel binder, the sum of all transactions must be allocated in this |
| 23 | * space. Large transactions are very error prone. In general, we should work to reduce this limit. |
| 24 | * The same limit is used in RPC binder for consistency. |
| 25 | */ |
| 26 | constexpr size_t kLogTransactionsOverBytes = 300 * 1024; |
| 27 | |
| 28 | /** |
| 29 | * See b/392575419 - this limit is chosen for a specific usecase, because RPC binder does not have |
| 30 | * support for shared memory in the Android Baklava timeframe. This was 100 KB during and before |
| 31 | * Android V. |
| 32 | * |
| 33 | * Keeping this low helps preserve overall system performance. Transactions of this size are far too |
| 34 | * expensive to make multiple copies over binder or sockets, and they should be avoided if at all |
| 35 | * possible and transition to shared memory. |
| 36 | */ |
| 37 | constexpr size_t kRpcTransactionLimitBytes = 600 * 1024; |
| 38 | |
| 39 | } // namespace android::binder |