Skip to content
Snippets Groups Projects
Commit a2be837e authored by Moe Jette's avatar Moe Jette
Browse files

Fixes for NUMA

parent 57b54f81
No related branches found
No related tags found
No related merge requests found
...@@ -110,7 +110,7 @@ int slurm_get_cpuset(char *path, pid_t pid, size_t size, cpu_set_t *mask) ...@@ -110,7 +110,7 @@ int slurm_get_cpuset(char *path, pid_t pid, size_t size, cpu_set_t *mask)
{ {
int fd, rc; int fd, rc;
char file_path[PATH_MAX]; char file_path[PATH_MAX];
char mstr[1 + CPU_SETSIZE / 4]; char mstr[1 + CPU_SETSIZE * 4];
snprintf(file_path, sizeof(file_path), "%s/cpus", path); snprintf(file_path, sizeof(file_path), "%s/cpus", path);
fd = open(file_path, O_RDONLY); fd = open(file_path, O_RDONLY);
...@@ -154,13 +154,12 @@ int slurm_memset_available(void) ...@@ -154,13 +154,12 @@ int slurm_memset_available(void)
return stat(file_path, &buf); return stat(file_path, &buf);
} }
int slurm_set_memset(char *path, nodemask_t *new_mask); int slurm_set_memset(char *path, nodemask_t *new_mask)
{ {
char file_path[PATH_MAX]; char file_path[PATH_MAX];
char mstr[1 + CPU_SETSIZE / 4], tmp[10]; char mstr[1 + CPU_SETSIZE * 4], tmp[10];
int fd, i, max_node, wrote; int fd, i, max_node;
ssize_t rc; ssize_t rc;
static nodemask_t mem_mask;
snprintf(file_path, sizeof(file_path), "%s/mems", CPUSET_DIR); snprintf(file_path, sizeof(file_path), "%s/mems", CPUSET_DIR);
fd = open(file_path, O_CREAT | O_RDONLY, 0700); fd = open(file_path, O_CREAT | O_RDONLY, 0700);
...@@ -171,7 +170,7 @@ int slurm_set_memset(char *path, nodemask_t *new_mask); ...@@ -171,7 +170,7 @@ int slurm_set_memset(char *path, nodemask_t *new_mask);
mstr[0] = '\0'; mstr[0] = '\0';
max_node = numa_max_node(); max_node = numa_max_node();
for (i=0, i<=max_node, i++) { for (i=0; i<=max_node; i++) {
if (!nodemask_isset(new_mask, i)) if (!nodemask_isset(new_mask, i))
continue; continue;
snprintf(tmp, sizeof(tmp), "%d", i); snprintf(tmp, sizeof(tmp), "%d", i);
...@@ -180,7 +179,7 @@ int slurm_set_memset(char *path, nodemask_t *new_mask); ...@@ -180,7 +179,7 @@ int slurm_set_memset(char *path, nodemask_t *new_mask);
strcat(mstr, tmp); strcat(mstr, tmp);
} }
i = strlen(i) + 1; i = strlen(mstr) + 1;
rc = write(fd, mstr, i+1); rc = write(fd, mstr, i+1);
close(fd); close(fd);
if (rc <= i) { if (rc <= i) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment