{"id":15934452,"url":"https://github.com/okeuday/cgroups","last_synced_at":"2025-03-24T21:32:03.381Z","repository":{"id":56841818,"uuid":"68169292","full_name":"okeuday/cgroups","owner":"okeuday","description":"Erlang native cgroups interface","archived":false,"fork":false,"pushed_at":"2023-10-26T18:24:32.000Z","size":93,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-14T03:29:55.761Z","etag":null,"topics":["cgroups","erlang","linux"],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/okeuday.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-09-14T03:15:55.000Z","updated_at":"2024-10-09T11:48:46.000Z","dependencies_parsed_at":"2022-08-29T07:41:55.645Z","dependency_job_id":"c1f9bfc9-0f96-4412-be0b-d22c39795939","html_url":"https://github.com/okeuday/cgroups","commit_stats":{"total_commits":40,"total_committers":2,"mean_commits":20.0,"dds":0.475,"last_synced_commit":"de55074cbb48a472167e0fe09c21145f54fdf880"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okeuday%2Fcgroups","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okeuday%2Fcgroups/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okeuday%2Fcgroups/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okeuday%2Fcgroups/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/okeuday","download_url":"https://codeload.github.com/okeuday/cgroups/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222012890,"owners_count":16916206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cgroups","erlang","linux"],"created_at":"2024-10-07T03:03:07.713Z","updated_at":"2024-10-29T08:02:45.707Z","avatar_url":"https://github.com/okeuday.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"Erlang cgroups interface\n========================\n\nAn interface for cgroups manipulation that handles cgroup version details\n(i.e., differences between [v1](https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt) and [v2](https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/cgroup-v2.rst))\nand provides safe usage of the cgroups filesystem mount.\n\nBuild\n-----\n\n    rebar compile\n\nExample\n-------\n\nUpdate or create the cgroup \"group1/nested1\" with the OS pid 19368,\nthen delete the cgroup path after moving the OS pid back to the root cgroup\n(executed as root).\n\n    # erl -pz ebin\n    1\u003e application:start(cgroups).\n    2\u003e OSPid0 = 19368.\n    3\u003e CGroupPath = \"group1/nested1\".\n    4\u003e {ok, CGroups} = cgroups:new().\n    5\u003e MemoryLimit = case cgroups:version(CGroups) of 1 -\u003e \"memory.limit_in_bytes\"; 2 -\u003e \"memory.high\" end.\n    6\u003e cgroups:update_or_create(CGroupPath,\n                                [OSPid0],\n                                [{MemoryLimit, \"10000000\"}],\n                                CGroups).\n    7\u003e cgroups:update(\"\", [OSPid0], [], CGroups).\n    8\u003e cgroups:delete_recursive(CGroupPath, CGroups).\n    9\u003e cgroups:destroy(CGroups).\n\n\nTroubleshooting\n---------------\n\n**`cgroups:update/4` and `cgroups:update_or_create/4` Errors:**\n* Either root execution of beam.smp or\n  `setcap cap_sys_admin=+ep /path/to/beam.smp` before execution is required\n  for most usage of cgroups\n* A Linux/systemd setup may have the control group setup mode set to `hybrid`\n  due to it being the [recommended default](https://github.com/systemd/systemd/blob/v239/NEWS#L1365)\n  for distributions.  However, that mode blocks the use of cgroup controllers\n  (the file `/sys/fs/cgroup/unified/cgroup.controllers` is empty)\n  because the cgroup controllers can only be [mounted in one hierarchy](https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#mounting)\n  (v1 or v2).  If cgroup v1 should be used, the Linux kernel argument\n  `systemd.legacy_systemd_cgroup_controller=1` can be used.\n  If cgroup v2 should be used, the Linux kernel argument\n  `systemd.unified_cgroup_hierarchy=1` can be used\n  (with systemd \u003e= `v226` and kernel \u003e= `4.2`) or\n  `cgroup_no_v1=all` can be used (with kernel \u003e= `4.6`).\n* Any non-root use should only use `cgroups:update/4` with more limited\n  controllers (memory, pids, possibly cpu and/or io) and all OS pids added\n  elsewhere as root\n\nAuthor\n------\n\nMichael Truog (mjtruog at protonmail dot com)\n\nLicense\n-------\n\nMIT License\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokeuday%2Fcgroups","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fokeuday%2Fcgroups","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokeuday%2Fcgroups/lists"}