Merge Android U (ab/10368041)
Bug: 291102124 Merged-In: I849958d9e9de3be48e32f57acc7b3526e184482c Change-Id: Ic765b54aa981b6370b5dff6b4cf046bbe9fbdbaf
This commit is contained in:
commit
4484eb1bfd
4 changed files with 56 additions and 116 deletions
|
@ -131,15 +131,28 @@ bool OptimizeSourceCopyOperation(const InstallOperation& operation, InstallOpera
|
|||
return is_optimized;
|
||||
}
|
||||
|
||||
void WriteExtent(DmSnapCowSizeCalculator* sc, const chromeos_update_engine::Extent& de,
|
||||
bool WriteExtent(DmSnapCowSizeCalculator* sc, const chromeos_update_engine::Extent& de,
|
||||
unsigned int sectors_per_block) {
|
||||
const auto block_boundary = de.start_block() + de.num_blocks();
|
||||
for (auto b = de.start_block(); b < block_boundary; ++b) {
|
||||
for (unsigned int s = 0; s < sectors_per_block; ++s) {
|
||||
const auto sector_id = b * sectors_per_block + s;
|
||||
// sector_id = b * sectors_per_block + s;
|
||||
uint64_t block_start_sector_id;
|
||||
if (__builtin_mul_overflow(b, sectors_per_block, &block_start_sector_id)) {
|
||||
LOG(ERROR) << "Integer overflow when calculating sector id (" << b << " * "
|
||||
<< sectors_per_block << ")";
|
||||
return false;
|
||||
}
|
||||
uint64_t sector_id;
|
||||
if (__builtin_add_overflow(block_start_sector_id, s, §or_id)) {
|
||||
LOG(ERROR) << "Integer overflow when calculating sector id ("
|
||||
<< block_start_sector_id << " + " << s << ")";
|
||||
return false;
|
||||
}
|
||||
sc->WriteSector(sector_id);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint64_t> PartitionCowCreator::GetCowSize() {
|
||||
|
@ -167,7 +180,7 @@ std::optional<uint64_t> PartitionCowCreator::GetCowSize() {
|
|||
// Allocate space for extra extents (if any). These extents are those that can be
|
||||
// used for error corrections or to store verity hash trees.
|
||||
for (const auto& de : extra_extents) {
|
||||
WriteExtent(&sc, de, sectors_per_block);
|
||||
if (!WriteExtent(&sc, de, sectors_per_block)) return std::nullopt;
|
||||
}
|
||||
|
||||
if (update == nullptr) return sc.cow_size_bytes();
|
||||
|
@ -182,7 +195,7 @@ std::optional<uint64_t> PartitionCowCreator::GetCowSize() {
|
|||
}
|
||||
|
||||
for (const auto& de : written_op->dst_extents()) {
|
||||
WriteExtent(&sc, de, sectors_per_block);
|
||||
if (!WriteExtent(&sc, de, sectors_per_block)) return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
{
|
||||
"Cgroups": [
|
||||
{
|
||||
"Controller": "blkio",
|
||||
"Path": "/dev/blkio",
|
||||
"Mode": "0775",
|
||||
"UID": "system",
|
||||
"GID": "system"
|
||||
},
|
||||
{
|
||||
"Controller": "cpu",
|
||||
"Path": "/dev/cpuctl",
|
||||
|
@ -32,12 +39,6 @@
|
|||
{
|
||||
"Controller": "freezer",
|
||||
"Path": "."
|
||||
},
|
||||
{
|
||||
"Controller": "io",
|
||||
"Path": ".",
|
||||
"NeedsActivation": true,
|
||||
"Optional": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -76,24 +76,6 @@
|
|||
"Name": "FreezerState",
|
||||
"Controller": "freezer",
|
||||
"File": "cgroup.freeze"
|
||||
},
|
||||
{
|
||||
"Name": "BfqWeight",
|
||||
"Controller": "io",
|
||||
"File": "blkio.bfq.weight",
|
||||
"FileV2": "io.bfq.weight"
|
||||
},
|
||||
{
|
||||
"Name": "CfqGroupIdle",
|
||||
"Controller": "io",
|
||||
"File": "blkio.group_idle",
|
||||
"FileV2": "io.group_idle"
|
||||
},
|
||||
{
|
||||
"Name": "CfqWeight",
|
||||
"Controller": "io",
|
||||
"File": "blkio.weight",
|
||||
"FileV2": "io.weight"
|
||||
}
|
||||
],
|
||||
|
||||
|
@ -457,30 +439,11 @@
|
|||
"Name": "LowIoPriority",
|
||||
"Actions": [
|
||||
{
|
||||
"Name": "SetAttribute",
|
||||
"Name": "JoinCgroup",
|
||||
"Params":
|
||||
{
|
||||
"Name": "BfqWeight",
|
||||
"Value": "10",
|
||||
"Optional": "true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "SetAttribute",
|
||||
"Params":
|
||||
{
|
||||
"Name": "CfqGroupIdle",
|
||||
"Value": "0",
|
||||
"Optional": "true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "SetAttribute",
|
||||
"Params":
|
||||
{
|
||||
"Name": "CfqWeight",
|
||||
"Value": "200",
|
||||
"Optional": "true"
|
||||
"Controller": "blkio",
|
||||
"Path": "background"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -489,30 +452,11 @@
|
|||
"Name": "NormalIoPriority",
|
||||
"Actions": [
|
||||
{
|
||||
"Name": "SetAttribute",
|
||||
"Name": "JoinCgroup",
|
||||
"Params":
|
||||
{
|
||||
"Name": "BfqWeight",
|
||||
"Value": "100",
|
||||
"Optional": "true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "SetAttribute",
|
||||
"Params":
|
||||
{
|
||||
"Name": "CfqGroupIdle",
|
||||
"Value": "0",
|
||||
"Optional": "true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "SetAttribute",
|
||||
"Params":
|
||||
{
|
||||
"Name": "CfqWeight",
|
||||
"Value": "1000",
|
||||
"Optional": "true"
|
||||
"Controller": "blkio",
|
||||
"Path": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -521,30 +465,11 @@
|
|||
"Name": "HighIoPriority",
|
||||
"Actions": [
|
||||
{
|
||||
"Name": "SetAttribute",
|
||||
"Name": "JoinCgroup",
|
||||
"Params":
|
||||
{
|
||||
"Name": "BfqWeight",
|
||||
"Value": "100",
|
||||
"Optional": "true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "SetAttribute",
|
||||
"Params":
|
||||
{
|
||||
"Name": "CfqGroupIdle",
|
||||
"Value": "0",
|
||||
"Optional": "true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "SetAttribute",
|
||||
"Params":
|
||||
{
|
||||
"Name": "CfqWeight",
|
||||
"Value": "1000",
|
||||
"Optional": "true"
|
||||
"Controller": "blkio",
|
||||
"Path": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -553,30 +478,11 @@
|
|||
"Name": "MaxIoPriority",
|
||||
"Actions": [
|
||||
{
|
||||
"Name": "SetAttribute",
|
||||
"Name": "JoinCgroup",
|
||||
"Params":
|
||||
{
|
||||
"Name": "BfqWeight",
|
||||
"Value": "100",
|
||||
"Optional": "true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "SetAttribute",
|
||||
"Params":
|
||||
{
|
||||
"Name": "CfqGroupIdle",
|
||||
"Value": "0",
|
||||
"Optional": "true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "SetAttribute",
|
||||
"Params":
|
||||
{
|
||||
"Name": "CfqWeight",
|
||||
"Value": "1000",
|
||||
"Optional": "true"
|
||||
"Controller": "blkio",
|
||||
"Path": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
@ -219,6 +219,26 @@ on init
|
|||
write /dev/stune/nnapi-hal/schedtune.boost 1
|
||||
write /dev/stune/nnapi-hal/schedtune.prefer_idle 1
|
||||
|
||||
# Create blkio group and apply initial settings.
|
||||
# This feature needs kernel to support it, and the
|
||||
# device's init.rc must actually set the correct values.
|
||||
mkdir /dev/blkio/background
|
||||
chown system system /dev/blkio
|
||||
chown system system /dev/blkio/background
|
||||
chown system system /dev/blkio/tasks
|
||||
chown system system /dev/blkio/background/tasks
|
||||
chown system system /dev/blkio/cgroup.procs
|
||||
chown system system /dev/blkio/background/cgroup.procs
|
||||
chmod 0664 /dev/blkio/tasks
|
||||
chmod 0664 /dev/blkio/background/tasks
|
||||
chmod 0664 /dev/blkio/cgroup.procs
|
||||
chmod 0664 /dev/blkio/background/cgroup.procs
|
||||
write /dev/blkio/blkio.weight 1000
|
||||
write /dev/blkio/background/blkio.weight 200
|
||||
write /dev/blkio/background/blkio.bfq.weight 10
|
||||
write /dev/blkio/blkio.group_idle 0
|
||||
write /dev/blkio/background/blkio.group_idle 0
|
||||
|
||||
restorecon_recursive /mnt
|
||||
|
||||
mount configfs none /config nodev noexec nosuid
|
||||
|
|
Loading…
Reference in a new issue