| 2498 | |
| 2499 | |
| 2500 | Try<Nothing> enable(const string& hierarchy, const string& cgroup) |
| 2501 | { |
| 2502 | Try<bool> enabled = killer::enabled(hierarchy, cgroup); |
| 2503 | |
| 2504 | if (enabled.isError()) { |
| 2505 | return Error(enabled.error()); |
| 2506 | } |
| 2507 | |
| 2508 | if (!enabled.get()) { |
| 2509 | Try<Nothing> write = cgroups::write( |
| 2510 | hierarchy, cgroup, "memory.oom_control", "0"); |
| 2511 | |
| 2512 | if (write.isError()) { |
| 2513 | return Error("Could not write 'memory.oom_control' control file: " + |
| 2514 | write.error()); |
| 2515 | } |
| 2516 | } |
| 2517 | |
| 2518 | return Nothing(); |
| 2519 | } |
| 2520 | |
| 2521 | |
| 2522 | Try<Nothing> disable(const string& hierarchy, const string& cgroup) |