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

Commit 8b0b53a9 authored by Marco Ballesio's avatar Marco Ballesio Committed by Gerrit Code Review
Browse files

Merge changes from topic "cgroup v2 freezer"

* changes:
  init.rc: remove initializations to cg2_bpf path
  libprocessgroup: json prototype for cgroups v2
  libprocessgroup: switch freezer to cgroup v2
  freezer: allow dynamic changes to freezer.state
parents cdfef7fe fdc03350
Loading
Loading
Loading
Loading
+13 −11
Original line number Original line Diff line number Diff line
@@ -39,19 +39,21 @@
      "Mode": "0755",
      "Mode": "0755",
      "UID": "system",
      "UID": "system",
      "GID": "system"
      "GID": "system"
    },
    }
  ],
  "Cgroups2": {
    "Path": "/sys/fs/cgroup",
    "Mode": "0755",
    "UID": "system",
    "GID": "system",
    "Controllers": [
      {
      {
        "Controller": "freezer",
        "Controller": "freezer",
      "Path": "/dev/freezer",
        "Path": "freezer",
        "Mode": "0755",
        "Mode": "0755",
        "UID": "system",
        "UID": "system",
        "GID": "system"
        "GID": "system"
      }
      }
  ],
    ]
  "Cgroups2": {
    "Path": "/dev/cg2_bpf",
    "Mode": "0600",
    "UID": "root",
    "GID": "root"
  }
  }
}
}
+7 −2
Original line number Original line Diff line number Diff line
@@ -24,19 +24,24 @@ message Cgroups {
    Cgroups2 cgroups2 = 2 [json_name = "Cgroups2"];
    Cgroups2 cgroups2 = 2 [json_name = "Cgroups2"];
}
}


// Next: 6
// Next: 7
message Cgroup {
message Cgroup {
    string controller = 1 [json_name = "Controller"];
    string controller = 1 [json_name = "Controller"];
    string path = 2 [json_name = "Path"];
    string path = 2 [json_name = "Path"];
    string mode = 3 [json_name = "Mode"];
    string mode = 3 [json_name = "Mode"];
    string uid = 4 [json_name = "UID"];
    string uid = 4 [json_name = "UID"];
    string gid = 5 [json_name = "GID"];
    string gid = 5 [json_name = "GID"];
// Booleans default to false when not specified. File reconstruction fails
// when a boolean is specified as false, so leave unspecified in that case
// https://developers.google.com/protocol-buffers/docs/proto3#default
    bool needs_activation = 6 [json_name = "NeedsActivation"];
}
}


// Next: 5
// Next: 6
message Cgroups2 {
message Cgroups2 {
    string path = 1 [json_name = "Path"];
    string path = 1 [json_name = "Path"];
    string mode = 2 [json_name = "Mode"];
    string mode = 2 [json_name = "Mode"];
    string uid = 3 [json_name = "UID"];
    string uid = 3 [json_name = "UID"];
    string gid = 4 [json_name = "GID"];
    string gid = 4 [json_name = "GID"];
    repeated Cgroup controllers = 5 [json_name = "Controllers"];
}
}
+33 −2
Original line number Original line Diff line number Diff line
@@ -49,6 +49,11 @@
      "Name": "UClampMax",
      "Name": "UClampMax",
      "Controller": "cpu",
      "Controller": "cpu",
      "File": "cpu.uclamp.max"
      "File": "cpu.uclamp.max"
    },
    {
      "Name": "FreezerState",
      "Controller": "freezer",
      "File": "cgroup.freeze"
    }
    }
  ],
  ],


@@ -74,7 +79,7 @@
          "Params":
          "Params":
          {
          {
            "Controller": "freezer",
            "Controller": "freezer",
            "Path": "frozen"
            "Path": ""
          }
          }
        }
        }
      ]
      ]
@@ -87,7 +92,7 @@
          "Params":
          "Params":
          {
          {
            "Controller": "freezer",
            "Controller": "freezer",
            "Path": ""
            "Path": "../"
          }
          }
        }
        }
      ]
      ]
@@ -531,6 +536,32 @@
          }
          }
        }
        }
      ]
      ]
    },
    {
      "Name": "FreezerDisabled",
      "Actions": [
        {
          "Name": "SetAttribute",
          "Params":
          {
            "Name": "FreezerState",
            "Value": "0"
          }
        }
      ]
    },
    {
      "Name": "FreezerEnabled",
      "Actions": [
        {
          "Name": "SetAttribute",
          "Params":
          {
            "Name": "FreezerState",
            "Value": "1"
          }
        }
      ]
    }
    }
  ],
  ],


+0 −12
Original line number Original line Diff line number Diff line
@@ -324,16 +324,6 @@ on init
    chmod 0664 /dev/cpuset/restricted/tasks
    chmod 0664 /dev/cpuset/restricted/tasks
    chmod 0664 /dev/cpuset/tasks
    chmod 0664 /dev/cpuset/tasks


    # freezer cgroup entries
    mkdir /dev/freezer/frozen
    write /dev/freezer/frozen/freezer.state FROZEN
    chown system system /dev/freezer/cgroup.procs
    chown system system /dev/freezer/frozen
    chown system system /dev/freezer/frozen/freezer.state
    chown system system /dev/freezer/frozen/cgroup.procs

    chmod 0444 /dev/freezer/frozen/freezer.state

    # make the PSI monitor accessible to others
    # make the PSI monitor accessible to others
    chown system system /proc/pressure/memory
    chown system system /proc/pressure/memory
    chmod 0664 /proc/pressure/memory
    chmod 0664 /proc/pressure/memory
@@ -348,8 +338,6 @@ on init
    # This is needed by any process that uses socket tagging.
    # This is needed by any process that uses socket tagging.
    chmod 0644 /dev/xt_qtaguid
    chmod 0644 /dev/xt_qtaguid


    chown root root /dev/cg2_bpf
    chmod 0600 /dev/cg2_bpf
    mount bpf bpf /sys/fs/bpf nodev noexec nosuid
    mount bpf bpf /sys/fs/bpf nodev noexec nosuid


    # Create location for fs_mgr to store abbreviated output from filesystem
    # Create location for fs_mgr to store abbreviated output from filesystem