Loading fs_mgr/libsnapshot/snapuserd/Android.bp +20 −0 Original line number Diff line number Diff line Loading @@ -86,10 +86,15 @@ cc_library_static { "libext4_utils", "libsnapshot_cow", "liburing", "libprocessgroup", "libjsoncpp", "libcgrouprc", "libcgrouprc_format", ], include_dirs: ["bionic/libc/kernel"], export_include_dirs: ["include"], header_libs: [ "libcutils_headers", "libstorage_literals_headers", ], ramdisk_available: true, Loading Loading @@ -126,6 +131,10 @@ cc_defaults { "liblog", "libsnapshot_cow", "libsnapuserd", "libprocessgroup", "libjsoncpp", "libcgrouprc", "libcgrouprc_format", "libsnapuserd_client", "libz", "liblz4", Loading @@ -135,6 +144,7 @@ cc_defaults { ], header_libs: [ "libcutils_headers", "libstorage_literals_headers", ], Loading Loading @@ -251,6 +261,10 @@ cc_defaults { "libgtest", "libsnapshot_cow", "libsnapuserd", "libprocessgroup", "libjsoncpp", "libcgrouprc", "libcgrouprc_format", "liburing", "libz", ], Loading @@ -261,6 +275,7 @@ cc_defaults { header_libs: [ "libstorage_literals_headers", "libfiemap_headers", "libcutils_headers", ], test_options: { min_shipping_api_level: 30, Loading Loading @@ -320,6 +335,10 @@ cc_binary_host { "libgflags", "libsnapshot_cow", "libsnapuserd", "libprocessgroup", "libjsoncpp", "libcgrouprc", "libcgrouprc_format", "liburing", "libz", ], Loading @@ -330,5 +349,6 @@ cc_binary_host { header_libs: [ "libstorage_literals_headers", "libfiemap_headers", "libcutils_headers", ], } fs_mgr/libsnapshot/snapuserd/user-space-merge/merge_worker.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -80,16 +80,16 @@ int MergeWorker::PrepareMerge(uint64_t* source_offset, int* pending_ops, } bool MergeWorker::MergeReplaceZeroOps() { // Flush after merging 2MB. Since all ops are independent and there is no // Flush after merging 1MB. Since all ops are independent and there is no // dependency between COW ops, we will flush the data and the number // of ops merged in COW block device. If there is a crash, we will // end up replaying some of the COW ops which were already merged. That is // ok. // // Although increasing this greater than 2MB may help in improving merge // Although increasing this greater than 1MB may help in improving merge // times; however, on devices with low memory, this can be problematic // when there are multiple merge threads in parallel. int total_ops_merged_per_commit = (PAYLOAD_BUFFER_SZ / BLOCK_SZ) * 2; int total_ops_merged_per_commit = (PAYLOAD_BUFFER_SZ / BLOCK_SZ); int num_ops_merged = 0; SNAP_LOG(INFO) << "MergeReplaceZeroOps started...."; Loading Loading @@ -561,6 +561,10 @@ bool MergeWorker::Run() { SNAP_PLOG(ERROR) << "Failed to set thread priority"; } if (!SetProfiles({"CPUSET_SP_BACKGROUND"})) { SNAP_PLOG(ERROR) << "Failed to assign task profile to Mergeworker thread"; } SNAP_LOG(INFO) << "Merge starting.."; bufsink_.Initialize(PAYLOAD_BUFFER_SZ); Loading fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_readahead.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -782,6 +782,10 @@ bool ReadAhead::RunThread() { SNAP_PLOG(ERROR) << "Failed to set thread priority"; } if (!SetProfiles({"CPUSET_SP_BACKGROUND"})) { SNAP_PLOG(ERROR) << "Failed to assign task profile to readahead thread"; } SNAP_LOG(INFO) << "ReadAhead processing."; while (!RAIterDone()) { if (!ReadAheadIOStart()) { Loading fs_mgr/libsnapshot/snapuserd/utility.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,9 @@ #include <unistd.h> #include <android-base/file.h> #include <processgroup/processgroup.h> #include <private/android_filesystem_config.h> namespace android { namespace snapshot { Loading @@ -33,6 +36,17 @@ bool SetThreadPriority([[maybe_unused]] int priority) { #endif } bool SetProfiles([[maybe_unused]] std::initializer_list<std::string_view> profiles) { #ifdef __ANDROID__ if (setgid(AID_SYSTEM)) { return false; } return SetTaskProfiles(gettid(), profiles); #else return true; #endif } bool KernelSupportsIoUring() { struct utsname uts {}; unsigned int major, minor; Loading fs_mgr/libsnapshot/snapuserd/utility.h +4 −0 Original line number Diff line number Diff line Loading @@ -14,10 +14,14 @@ #pragma once #include <initializer_list> #include <string_view> namespace android { namespace snapshot { bool SetThreadPriority(int priority); bool SetProfiles(std::initializer_list<std::string_view> profiles); bool KernelSupportsIoUring(); } // namespace snapshot Loading Loading
fs_mgr/libsnapshot/snapuserd/Android.bp +20 −0 Original line number Diff line number Diff line Loading @@ -86,10 +86,15 @@ cc_library_static { "libext4_utils", "libsnapshot_cow", "liburing", "libprocessgroup", "libjsoncpp", "libcgrouprc", "libcgrouprc_format", ], include_dirs: ["bionic/libc/kernel"], export_include_dirs: ["include"], header_libs: [ "libcutils_headers", "libstorage_literals_headers", ], ramdisk_available: true, Loading Loading @@ -126,6 +131,10 @@ cc_defaults { "liblog", "libsnapshot_cow", "libsnapuserd", "libprocessgroup", "libjsoncpp", "libcgrouprc", "libcgrouprc_format", "libsnapuserd_client", "libz", "liblz4", Loading @@ -135,6 +144,7 @@ cc_defaults { ], header_libs: [ "libcutils_headers", "libstorage_literals_headers", ], Loading Loading @@ -251,6 +261,10 @@ cc_defaults { "libgtest", "libsnapshot_cow", "libsnapuserd", "libprocessgroup", "libjsoncpp", "libcgrouprc", "libcgrouprc_format", "liburing", "libz", ], Loading @@ -261,6 +275,7 @@ cc_defaults { header_libs: [ "libstorage_literals_headers", "libfiemap_headers", "libcutils_headers", ], test_options: { min_shipping_api_level: 30, Loading Loading @@ -320,6 +335,10 @@ cc_binary_host { "libgflags", "libsnapshot_cow", "libsnapuserd", "libprocessgroup", "libjsoncpp", "libcgrouprc", "libcgrouprc_format", "liburing", "libz", ], Loading @@ -330,5 +349,6 @@ cc_binary_host { header_libs: [ "libstorage_literals_headers", "libfiemap_headers", "libcutils_headers", ], }
fs_mgr/libsnapshot/snapuserd/user-space-merge/merge_worker.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -80,16 +80,16 @@ int MergeWorker::PrepareMerge(uint64_t* source_offset, int* pending_ops, } bool MergeWorker::MergeReplaceZeroOps() { // Flush after merging 2MB. Since all ops are independent and there is no // Flush after merging 1MB. Since all ops are independent and there is no // dependency between COW ops, we will flush the data and the number // of ops merged in COW block device. If there is a crash, we will // end up replaying some of the COW ops which were already merged. That is // ok. // // Although increasing this greater than 2MB may help in improving merge // Although increasing this greater than 1MB may help in improving merge // times; however, on devices with low memory, this can be problematic // when there are multiple merge threads in parallel. int total_ops_merged_per_commit = (PAYLOAD_BUFFER_SZ / BLOCK_SZ) * 2; int total_ops_merged_per_commit = (PAYLOAD_BUFFER_SZ / BLOCK_SZ); int num_ops_merged = 0; SNAP_LOG(INFO) << "MergeReplaceZeroOps started...."; Loading Loading @@ -561,6 +561,10 @@ bool MergeWorker::Run() { SNAP_PLOG(ERROR) << "Failed to set thread priority"; } if (!SetProfiles({"CPUSET_SP_BACKGROUND"})) { SNAP_PLOG(ERROR) << "Failed to assign task profile to Mergeworker thread"; } SNAP_LOG(INFO) << "Merge starting.."; bufsink_.Initialize(PAYLOAD_BUFFER_SZ); Loading
fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_readahead.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -782,6 +782,10 @@ bool ReadAhead::RunThread() { SNAP_PLOG(ERROR) << "Failed to set thread priority"; } if (!SetProfiles({"CPUSET_SP_BACKGROUND"})) { SNAP_PLOG(ERROR) << "Failed to assign task profile to readahead thread"; } SNAP_LOG(INFO) << "ReadAhead processing."; while (!RAIterDone()) { if (!ReadAheadIOStart()) { Loading
fs_mgr/libsnapshot/snapuserd/utility.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,9 @@ #include <unistd.h> #include <android-base/file.h> #include <processgroup/processgroup.h> #include <private/android_filesystem_config.h> namespace android { namespace snapshot { Loading @@ -33,6 +36,17 @@ bool SetThreadPriority([[maybe_unused]] int priority) { #endif } bool SetProfiles([[maybe_unused]] std::initializer_list<std::string_view> profiles) { #ifdef __ANDROID__ if (setgid(AID_SYSTEM)) { return false; } return SetTaskProfiles(gettid(), profiles); #else return true; #endif } bool KernelSupportsIoUring() { struct utsname uts {}; unsigned int major, minor; Loading
fs_mgr/libsnapshot/snapuserd/utility.h +4 −0 Original line number Diff line number Diff line Loading @@ -14,10 +14,14 @@ #pragma once #include <initializer_list> #include <string_view> namespace android { namespace snapshot { bool SetThreadPriority(int priority); bool SetProfiles(std::initializer_list<std::string_view> profiles); bool KernelSupportsIoUring(); } // namespace snapshot Loading