Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fcae4545 authored by Xin Li's avatar Xin Li Committed by Android (Google) Code Review
Browse files

Merge "Merge Android U (ab/10368041)" into aosp-main-future

parents f148dbb4 4484eb1b
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -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, &sector_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;
        }
    }

+7 −6
Original line number Diff line number Diff line
{
  "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
      }
    ]
  }
+12 −106
Original line number Diff line number Diff line
@@ -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",
          "Params":
          {
            "Name": "BfqWeight",
            "Value": "10",
            "Optional": "true"
          }
        },
        {
          "Name": "SetAttribute",
          "Params":
          {
            "Name": "CfqGroupIdle",
            "Value": "0",
            "Optional": "true"
          }
        },
        {
          "Name": "SetAttribute",
          "Name": "JoinCgroup",
          "Params":
          {
            "Name": "CfqWeight",
            "Value": "200",
            "Optional": "true"
            "Controller": "blkio",
            "Path": "background"
          }
        }
      ]
@@ -489,30 +452,11 @@
      "Name": "NormalIoPriority",
      "Actions": [
        {
          "Name": "SetAttribute",
          "Params":
          {
            "Name": "BfqWeight",
            "Value": "100",
            "Optional": "true"
          }
        },
        {
          "Name": "SetAttribute",
          "Params":
          {
            "Name": "CfqGroupIdle",
            "Value": "0",
            "Optional": "true"
          }
        },
        {
          "Name": "SetAttribute",
          "Name": "JoinCgroup",
          "Params":
          {
            "Name": "CfqWeight",
            "Value": "1000",
            "Optional": "true"
            "Controller": "blkio",
            "Path": ""
          }
        }
      ]
@@ -521,30 +465,11 @@
      "Name": "HighIoPriority",
      "Actions": [
        {
          "Name": "SetAttribute",
          "Params":
          {
            "Name": "BfqWeight",
            "Value": "100",
            "Optional": "true"
          }
        },
        {
          "Name": "SetAttribute",
          "Params":
          {
            "Name": "CfqGroupIdle",
            "Value": "0",
            "Optional": "true"
          }
        },
        {
          "Name": "SetAttribute",
          "Name": "JoinCgroup",
          "Params":
          {
            "Name": "CfqWeight",
            "Value": "1000",
            "Optional": "true"
            "Controller": "blkio",
            "Path": ""
          }
        }
      ]
@@ -553,30 +478,11 @@
      "Name": "MaxIoPriority",
      "Actions": [
        {
          "Name": "SetAttribute",
          "Params":
          {
            "Name": "BfqWeight",
            "Value": "100",
            "Optional": "true"
          }
        },
        {
          "Name": "SetAttribute",
          "Params":
          {
            "Name": "CfqGroupIdle",
            "Value": "0",
            "Optional": "true"
          }
        },
        {
          "Name": "SetAttribute",
          "Name": "JoinCgroup",
          "Params":
          {
            "Name": "CfqWeight",
            "Value": "1000",
            "Optional": "true"
            "Controller": "blkio",
            "Path": ""
          }
        }
      ]
+20 −0
Original line number Diff line number Diff line
@@ -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