Commit 1d7b5661 authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼

Merge branch 'fix-kernel-hugepage' into 'master'

Fix return code of kernel_set_nr_hugepages()

See merge request !4
parents 275c193f 395cb389
......@@ -251,16 +251,19 @@ int kernel_get_nr_hugepages()
int kernel_set_nr_hugepages(int nr)
FILE *f;
int ret;
f = fopen(PROCFS_PATH "/sys/vm/nr_hugepages", "w");
if (!f) {
if (access("/.dockerenv", F_OK) != -1) {
ret = access("/.dockerenv", F_OK);
if (ret != -1) {
warning("This functionality is unavailable in this mode. Please run the Docker container in the privileged mode:");
warning(" $ docker run --privilged ...");
serror("Failed to open %s", PROCFS_PATH "/sys/vm/nr_hugepages");
warning("Failed to open %s", PROCFS_PATH "/sys/vm/nr_hugepages");
return -1;
fprintf(f, "%d\n", nr);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment