Merge changes Iba59fdc3,I812fccf2 into main am: 8d63f0080a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/3114109 Change-Id: Icf8a1278e1957f140f48fb88d4d50c4dca9ccfc0 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
f2500732b9
3 changed files with 19 additions and 6 deletions
|
@ -577,8 +577,10 @@ bool MergeWorker::Run() {
|
|||
SNAP_LOG(ERROR) << "Merge terminated early...";
|
||||
return true;
|
||||
}
|
||||
auto merge_thread_priority = android::base::GetUintProperty<uint>(
|
||||
"ro.virtual_ab.merge_thread_priority", ANDROID_PRIORITY_BACKGROUND);
|
||||
|
||||
if (!SetThreadPriority(ANDROID_PRIORITY_BACKGROUND)) {
|
||||
if (!SetThreadPriority(merge_thread_priority)) {
|
||||
SNAP_PLOG(ERROR) << "Failed to set thread priority";
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,10 @@
|
|||
#include <libsnapshot/cow_format.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "android-base/properties.h"
|
||||
#include "read_worker.h"
|
||||
#include "snapuserd_core.h"
|
||||
#include "user-space-merge/worker.h"
|
||||
#include "utility.h"
|
||||
|
||||
namespace android {
|
||||
|
@ -259,8 +261,10 @@ bool ReadWorker::Run() {
|
|||
SNAP_LOG(INFO) << "Processing snapshot I/O requests....";
|
||||
|
||||
pthread_setname_np(pthread_self(), "ReadWorker");
|
||||
auto worker_thread_priority = android::base::GetUintProperty<uint>(
|
||||
"ro.virtual_ab.worker_thread_priority", ANDROID_PRIORITY_NORMAL);
|
||||
|
||||
if (!SetThreadPriority(ANDROID_PRIORITY_NORMAL)) {
|
||||
if (!SetThreadPriority(worker_thread_priority)) {
|
||||
SNAP_PLOG(ERROR) << "Failed to set thread priority";
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <android-base/scopeguard.h>
|
||||
#include <android-base/strings.h>
|
||||
|
||||
#include "android-base/properties.h"
|
||||
#include "snapuserd_core.h"
|
||||
|
||||
namespace android {
|
||||
|
@ -104,7 +105,9 @@ bool UpdateVerify::VerifyBlocks(const std::string& partition_name,
|
|||
}
|
||||
|
||||
loff_t file_offset = offset;
|
||||
const uint64_t read_sz = kBlockSizeVerify;
|
||||
auto verify_block_size = android::base::GetUintProperty<uint>("ro.virtual_ab.verify_block_size",
|
||||
kBlockSizeVerify);
|
||||
const uint64_t read_sz = verify_block_size;
|
||||
|
||||
void* addr;
|
||||
ssize_t page_size = getpagesize();
|
||||
|
@ -130,7 +133,7 @@ bool UpdateVerify::VerifyBlocks(const std::string& partition_name,
|
|||
}
|
||||
|
||||
bytes_read += to_read;
|
||||
file_offset += (skip_blocks * kBlockSizeVerify);
|
||||
file_offset += (skip_blocks * verify_block_size);
|
||||
if (file_offset >= dev_sz) {
|
||||
break;
|
||||
}
|
||||
|
@ -184,7 +187,9 @@ bool UpdateVerify::VerifyPartition(const std::string& partition_name,
|
|||
* latency.
|
||||
*/
|
||||
int num_threads = kMinThreadsToVerify;
|
||||
if (dev_sz > kThresholdSize) {
|
||||
auto verify_threshold_size = android::base::GetUintProperty<uint>(
|
||||
"ro.virtual_ab.verify_threshold_size", kThresholdSize);
|
||||
if (dev_sz > verify_threshold_size) {
|
||||
num_threads = kMaxThreadsToVerify;
|
||||
}
|
||||
|
||||
|
@ -192,11 +197,13 @@ bool UpdateVerify::VerifyPartition(const std::string& partition_name,
|
|||
off_t start_offset = 0;
|
||||
const int skip_blocks = num_threads;
|
||||
|
||||
auto verify_block_size =
|
||||
android::base::GetUintProperty("ro.virtual_ab.verify_block_size", kBlockSizeVerify);
|
||||
while (num_threads) {
|
||||
threads.emplace_back(std::async(std::launch::async, &UpdateVerify::VerifyBlocks, this,
|
||||
partition_name, dm_block_device, start_offset, skip_blocks,
|
||||
dev_sz));
|
||||
start_offset += kBlockSizeVerify;
|
||||
start_offset += verify_block_size;
|
||||
num_threads -= 1;
|
||||
if (start_offset >= dev_sz) {
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue