From fb014fc6e81b086c63398267d996d6972b7f35ce Mon Sep 17 00:00:00 2001 From: Hyeeun Jun Date: Wed, 25 Oct 2023 13:59:42 +0900 Subject: [PATCH] Reduce AppFuse max read size. Since the max read size of FUSE is 128KB in default, the socket header of the appfuse epollcontroller is allocated in order 4 (64KB). When memory environment is in insufficient situation that has a lot of fragment, order 4 size memory allication is impossible, so more than several tens of seconds could take to allocate the socket header. To prevent the issue, limit the fuse read size to 64KB, so that the memory allocation order of the socket header is changed to order 2. Bug: 312503249 Test: atest AppFusePerfTest Change-Id: I7020801b7539d980515885396916f8be1f1008e9 --- AppFuseUtil.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/AppFuseUtil.cpp b/AppFuseUtil.cpp index 711e70b..a3beaec 100644 --- a/AppFuseUtil.cpp +++ b/AppFuseUtil.cpp @@ -50,14 +50,15 @@ static android::status_t GetMountPath(uid_t uid, const std::string& name, std::s static android::status_t Mount(int device_fd, const std::string& path) { const auto opts = StringPrintf( - "fd=%i," - "rootmode=40000," - "default_permissions," - "allow_other," - "user_id=0,group_id=0," - "context=\"u:object_r:app_fuse_file:s0\"," - "fscontext=u:object_r:app_fusefs:s0", - device_fd); + "fd=%i," + "rootmode=40000," + "default_permissions," + "allow_other," + "max_read=65536," + "user_id=0,group_id=0," + "context=\"u:object_r:app_fuse_file:s0\"," + "fscontext=u:object_r:app_fusefs:s0", + device_fd); const int result = TEMP_FAILURE_RETRY(mount("/dev/fuse", path.c_str(), "fuse",