-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the code easier to read #6
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cleaned up the code blocks so that they render properly on screen.
Thanks for contributing this; we previously didn't have a way to accept these types of pull requests but now do. Unfortunately, we made the change from textile -> markdown without this patch, but appreciate your contribution! |
andreaspeters
pushed a commit
to m3scluster/clusterd
that referenced
this pull request
Mar 27, 2024
# Das ist die erste Commit-Beschreibung: [cgroups2][ebpf] Addresses formatting inconsistences. - Two free lines between functions. - One free line between ending namespaces. - One free line between methods. - Ending namespace having format `} // namespace <name> {`. This closes apache#514 # Das ist Commit-Beschreibung #2: [cgroups2] FIX: Updated `subsystems` namespace to, new, `controllers` namespace, in tests. The commit 35ecb9a, which renamed `subsystems` to `controllers` missed this one instance, inside of the tests. # Das ist Commit-Beschreibung #3: [cgroups2] Adds cgroups2::controllers::enabled(). This provides access to cgroup.subtree_control which indicates which controllers are enabled on the cgroup. This closes apache#510 # Das ist Commit-Beschreibung #4: [mesos-tidy] Fix broken Dockerfile due to llvm repo move. This appears to fix the mesos-tidy docker image build, which now works per the readme instructions: ``` $ docker build -t mesos-tidy . ``` Running the image was hitting gcc internal errors due to OOMs, which I fixed via the updates shown in the readme. # Das ist Commit-Beschreibung #5: Address clang-tidy errors. Fixes clang-tidy errors in ebpf and cgroups2. # Das ist Commit-Beschreibung apache#6: [cgroups2] Introduces cgroups2::create() to create new cgroups. Adds `cgroups2::create` to the cgroups2 API, allowing new cgroups to be created. This closes apache#520 # Das ist Commit-Beschreibung apache#7: [cgroups2] Introduced cgroups2::destroy() to remove a cgroup. Adds `cgroups2::destroy()` to destroy cgroups. Returns an error if the provided cgroup: - Does not exist. - Has child processes, or otherwise can't be destroyed. This closes apache#521 # Das ist Commit-Beschreibung apache#8: [cgroups2] Use rmdir instead of rm -rf to delete a cgroup. Even with `sudo` permissions, `rm -rf` fails with "Operation not permitted" when deleting a directory inside of `/sys/fs/cgroup`. On the other hand, `sudo rmdir` does not fail. `os::rmdir` uses `rm -rf` when `recursive=true` and `rmdir` when `recursive=false`. Hence, we set `recursive=false` so cgroups can be removed. # Das ist Commit-Beschreibung apache#9: [cgroups2] Introduces API to move a process into a cgroup, by PID. A process can be moved into a cgroup by writing its process id into the cgroup's `cgroup.procs` file. When a process is moved, all its threads move with it. In this PR we introduce `cgroups2::move_process` to add a process to a cgroup, `cgroups2::cgroup` to check which cgroup a process is a member of, and test the introduced functionality. This closes apache#523 # Das ist Commit-Beschreibung apache#10: [cgroups2] Introduces cgroups2::exists to check if a cgroup exists. If you call `cgroups2::destroy` on a cgroup that does not exist, it will throw an error. This is expected. However, it means that the caller needs to know whether a cgroup exists. This PR introduces `cgroups2::exists`, allowing the caller find out if a cgroup exists. This is useful, for example, for test fixtures where cgroups from a previous run of a test may or may not be cleaned up, depending on whether or not the test was successful. # Das ist Commit-Beschreibung apache#11: [cgroups2] Convert cgroups2::read/write to template functions. To allow overloading of `read` by return type alone, we define `cgroups::read` as a template function. For consistency, we do the same for `cgroups::write`. This closes apache#526 # Das ist Commit-Beschreibung apache#12: Removed `-k` option when installing Ruby # Das ist Commit-Beschreibung apache#13: [cgroups2] Introduces the cpu namespace and cpu::weight() API Introduces the `cpu` namespace for cgroups2, and expose an API to set the CPU weight for a cgroup. In cgroups v2, CPU cycles are allocated based on weights that are assigned to cgroups, using the "cpu.weight" control. Specifically, a cgroup has access to 100*(weight/total_weight)% of CPU access. This closes apache#522 # Das ist Commit-Beschreibung apache#14: [cgroups2] Test fixture to cleanup `TEST_CGROUP`. Many cgroups tests require creating a child cgroup and then updating control files within that cgroup. To avoid requiring test writers to manually cleanup and conditionally create `TEST_CGROUP`, we add cleanup logic to the setup and teardown of the `Cgroups2Test` test fixture. This closes apache#528 # Das ist Commit-Beschreibung apache#15: [ebpf] Fix clang-tidy false positive. We need to figure out the length of the verifier logs by scanning for the first \0 byte, our current approach trips a clang-tidy warning. This patch should silence it, by instead resizing the string down appropriately and using the string directly. # Das ist Commit-Beschreibung apache#16: [cgroups2] Add cgroups2::path to get the path of a cgroup. Introduces a utility to get the absolute path of a cgroup and refactors code to use it. This closes apache#529 # Das ist Commit-Beschreibung apache#17: [cgroups2] Fix controllers::enable/available empty handling. "cgroup.controllers" and "cgroup.subtree_control" control files can be empty, in which case `strings::split(s, " ")` returns `[""]` which causes us to use an empty string for a controller. This closes apache#530 # Das ist Commit-Beschreibung apache#18: [cgroups2] Add an interface to read and assign processes. `cgroup.procs` lists all of the processes inside of a cgroup, one per line. There may be duplicates. A single process can be moved into a cgroup by writing its process ID into `cgroup.procs`. Here we introduce: - Reading the processes inside of a cgroup, and - Assigning a process to a cgroup. This closes apache#532 # Das ist Commit-Beschreibung apache#19: [cgroups2] Add override to silence tidy errors. # Das ist Commit-Beschreibung apache#20: [cgroups2] Addressing comments from apache#532 Commit 60283df was merged before the PR comments were addressed. This commit address the comments. - We remove `cgroups2::move_process` in favor of `cgroups2::assign`, which is consistent with the `cgroups` v1 function naming. - We remove a duplicate test for assigning processes to cgroups. - We remove a string copy when fetching the processes PIDs in a cgroup. This closes apache#533 # Das ist Commit-Beschreibung apache#21: [cgroups2] Support device access permissions via ebpf. Cgroups v2 uses eBPF to manage device access permissions. For each cgroup, we attach a `BPF_PROG_TYPE_CGROUP_DEVICE` program type to the `BPF_CGROUP_DEVICE` eBPF kernel hook. The attached program will be run for every device access made from within the cgroup. If the program returns a `0` exit code the device access is denied, otherwise it is allowed. For more information about the Device Controller in cgroups v2: https://docs.kernel.org/admin-guide/cgroup-v2.html#device-controller This closes apache#519 # Das ist Commit-Beschreibung apache#22: [cgroups2] Added flag to enable cgroups v2.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cleaned up the code blocks so that they render properly on screen.