|
Lines 37-42
Link Here
|
| 37 |
extern int num_numa_nodes; |
37 |
extern int num_numa_nodes; |
| 38 |
#endif /* NUMA_SUPPORT */ |
38 |
#endif /* NUMA_SUPPORT */ |
| 39 |
|
39 |
|
|
|
40 |
#include <linux/version.h> |
| 41 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) |
| 42 |
#define CPUSET_PREFIX "cpuset." |
| 43 |
#else |
| 44 |
#define CPUSET_PREFIX "" |
| 45 |
#endif |
| 46 |
|
| 40 |
extern long system_ncpus; |
47 |
extern long system_ncpus; |
| 41 |
|
48 |
|
| 42 |
/* FIXME: TODO: TTORQUECPUSET_PATH, enabling cpuset support, and correct error |
49 |
/* FIXME: TODO: TTORQUECPUSET_PATH, enabling cpuset support, and correct error |
|
Lines 442-448
Link Here
|
| 442 |
|
449 |
|
| 443 |
/* make sure cpusets are available */ |
450 |
/* make sure cpusets are available */ |
| 444 |
|
451 |
|
| 445 |
sprintf(path, "%s/cpus", TROOTCPUSET_PATH); |
452 |
sprintf(path, "%s/%scpus", TROOTCPUSET_PATH, CPUSET_PREFIX); |
| 446 |
|
453 |
|
| 447 |
if (lstat(path, &statbuf) != 0) |
454 |
if (lstat(path, &statbuf) != 0) |
| 448 |
{ |
455 |
{ |
|
Lines 480-487
Link Here
|
| 480 |
|
487 |
|
| 481 |
/* load cpus in root set */ |
488 |
/* load cpus in root set */ |
| 482 |
|
489 |
|
| 483 |
sprintf(path, "%s/cpus", |
490 |
sprintf(path, "%s/%scpus", |
| 484 |
TROOTCPUSET_PATH); |
491 |
TROOTCPUSET_PATH, CPUSET_PREFIX); |
| 485 |
|
492 |
|
| 486 |
fp = fopen(path, "r"); |
493 |
fp = fopen(path, "r"); |
| 487 |
|
494 |
|
|
Lines 519-526
Link Here
|
| 519 |
|
526 |
|
| 520 |
/* NOTE: load 'boot' set */ |
527 |
/* NOTE: load 'boot' set */ |
| 521 |
|
528 |
|
| 522 |
sprintf(path, "%s/boot/cpus", |
529 |
sprintf(path, "%s/boot/%scpus", |
| 523 |
TROOTCPUSET_PATH); |
530 |
TROOTCPUSET_PATH, CPUSET_PREFIX); |
| 524 |
|
531 |
|
| 525 |
fp = fopen(path, "r"); |
532 |
fp = fopen(path, "r"); |
| 526 |
|
533 |
|
|
Lines 554-561
Link Here
|
| 554 |
|
561 |
|
| 555 |
/* create new TORQUE cpus set */ |
562 |
/* create new TORQUE cpus set */ |
| 556 |
|
563 |
|
| 557 |
sprintf(path, "%s/cpus", |
564 |
sprintf(path, "%s/%scpus", |
| 558 |
TTORQUECPUSET_PATH); |
565 |
TTORQUECPUSET_PATH, CPUSET_PREFIX); |
| 559 |
|
566 |
|
| 560 |
fp = fopen(path, "w"); |
567 |
fp = fopen(path, "w"); |
| 561 |
|
568 |
|
|
Lines 588-595
Link Here
|
| 588 |
|
595 |
|
| 589 |
/* add all mems to torqueset */ |
596 |
/* add all mems to torqueset */ |
| 590 |
|
597 |
|
| 591 |
sprintf(path, "%s/mems", |
598 |
sprintf(path, "%s/%smems", |
| 592 |
TROOTCPUSET_PATH); |
599 |
TROOTCPUSET_PATH, CPUSET_PREFIX); |
| 593 |
|
600 |
|
| 594 |
fp = fopen(path, "r"); |
601 |
fp = fopen(path, "r"); |
| 595 |
|
602 |
|
|
Lines 622-629
Link Here
|
| 622 |
|
629 |
|
| 623 |
/* NOTE: load 'boot' set */ |
630 |
/* NOTE: load 'boot' set */ |
| 624 |
|
631 |
|
| 625 |
sprintf(path, "%s/boot/mems", |
632 |
sprintf(path, "%s/boot/%smems", |
| 626 |
TROOTCPUSET_PATH); |
633 |
TROOTCPUSET_PATH, CPUSET_PREFIX); |
| 627 |
|
634 |
|
| 628 |
fp = fopen(path, "r"); |
635 |
fp = fopen(path, "r"); |
| 629 |
|
636 |
|
|
Lines 657-664
Link Here
|
| 657 |
|
664 |
|
| 658 |
/* create new TORQUE mems set */ |
665 |
/* create new TORQUE mems set */ |
| 659 |
|
666 |
|
| 660 |
sprintf(path, "%s/mems", |
667 |
sprintf(path, "%s/%smems", |
| 661 |
TTORQUECPUSET_PATH); |
668 |
TTORQUECPUSET_PATH, CPUSET_PREFIX); |
| 662 |
|
669 |
|
| 663 |
fp = fopen(path, "w"); |
670 |
fp = fopen(path, "w"); |
| 664 |
|
671 |
|
|
Lines 1015-1021
Link Here
|
| 1015 |
/* don't "else return(FAILURE);" because the directory doesn't necessarily exist */ |
1022 |
/* don't "else return(FAILURE);" because the directory doesn't necessarily exist */ |
| 1016 |
|
1023 |
|
| 1017 |
/* create the directory and copy the relevant memory data */ |
1024 |
/* create the directory and copy the relevant memory data */ |
| 1018 |
snprintf(tmppath,sizeof(tmppath),"%s/mems",TTORQUECPUSET_PATH); |
1025 |
snprintf(tmppath,sizeof(tmppath),"%s/%smems",TTORQUECPUSET_PATH, CPUSET_PREFIX); |
| 1019 |
if (access(TTORQUECPUSET_PATH, F_OK) == 0) |
1026 |
if (access(TTORQUECPUSET_PATH, F_OK) == 0) |
| 1020 |
{ |
1027 |
{ |
| 1021 |
|
1028 |
|
|
Lines 1040-1046
Link Here
|
| 1040 |
} |
1047 |
} |
| 1041 |
|
1048 |
|
| 1042 |
fclose(fd); |
1049 |
fclose(fd); |
| 1043 |
snprintf(tmppath,sizeof(tmppath),"%s/mems",path); |
1050 |
snprintf(tmppath,sizeof(tmppath),"%s/%smems",path, CPUSET_PREFIX); |
| 1044 |
fd = fopen(tmppath, "w"); |
1051 |
fd = fopen(tmppath, "w"); |
| 1045 |
if (fd) |
1052 |
if (fd) |
| 1046 |
{ |
1053 |
{ |
|
Lines 1088-1093
Link Here
|
| 1088 |
vnodent *np; |
1095 |
vnodent *np; |
| 1089 |
int j; |
1096 |
int j; |
| 1090 |
int rc = SUCCESS; |
1097 |
int rc = SUCCESS; |
|
|
1098 |
int tmppath_len; |
| 1091 |
|
1099 |
|
| 1092 |
char *id = "create_vnodesets"; |
1100 |
char *id = "create_vnodesets"; |
| 1093 |
char cpusbuf[MAXPATHLEN+1]; |
1101 |
char cpusbuf[MAXPATHLEN+1]; |
|
Lines 1105-1111
Link Here
|
| 1105 |
mkdir(tmppath, 0755); |
1113 |
mkdir(tmppath, 0755); |
| 1106 |
chmod(tmppath, 00755); |
1114 |
chmod(tmppath, 00755); |
| 1107 |
sprintf(tasksbuf, "%d", np->vn_index); |
1115 |
sprintf(tasksbuf, "%d", np->vn_index); |
| 1108 |
strcat(tmppath, "/cpus"); |
1116 |
tmppath_len=strlen(tmppath); |
|
|
1117 |
snprintf(tmppath+tmppath_len, sizeof(tmppath)-tmppath_len, "/%scpus", CPUSET_PREFIX); |
| 1109 |
sprintf(log_buffer, "TASKSET: %s cpus %s\n", tmppath, tasksbuf); |
1118 |
sprintf(log_buffer, "TASKSET: %s cpus %s\n", tmppath, tasksbuf); |
| 1110 |
log_event(PBSEVENT_SYSTEM, |
1119 |
log_event(PBSEVENT_SYSTEM, |
| 1111 |
PBS_EVENTCLASS_SERVER, |
1120 |
PBS_EVENTCLASS_SERVER, |
|
Lines 1129-1135
Link Here
|
| 1129 |
memset(tasksbuf, '\0', sizeof(tasksbuf)); |
1138 |
memset(tasksbuf, '\0', sizeof(tasksbuf)); |
| 1130 |
|
1139 |
|
| 1131 |
/* add all mems to torqueset - membuf has info stored */ |
1140 |
/* add all mems to torqueset - membuf has info stored */ |
| 1132 |
sprintf(tmppath, "%s/%d/%s",path,np->vn_node,"/mems"); |
1141 |
sprintf(tmppath, "%s/%d/%smems",path,np->vn_node,CPUSET_PREFIX); |
| 1133 |
fd = fopen(tmppath, "w"); |
1142 |
fd = fopen(tmppath, "w"); |
| 1134 |
|
1143 |
|
| 1135 |
if (fd) |
1144 |
if (fd) |
|
Lines 1200-1206
Link Here
|
| 1200 |
get_cpu_string(pjob,cpusbuf); |
1209 |
get_cpu_string(pjob,cpusbuf); |
| 1201 |
#endif /* end NUMA_SUPPORT */ |
1210 |
#endif /* end NUMA_SUPPORT */ |
| 1202 |
|
1211 |
|
| 1203 |
snprintf(tmppath,sizeof(tmppath),"%s/cpus",path); |
1212 |
snprintf(tmppath,sizeof(tmppath),"%s/%scpus",path, CPUSET_PREFIX); |
| 1204 |
|
1213 |
|
| 1205 |
sprintf(log_buffer, "CPUSET: %s job %s path %s\n", cpusbuf, |
1214 |
sprintf(log_buffer, "CPUSET: %s job %s path %s\n", cpusbuf, |
| 1206 |
pjob->ji_qs.ji_jobid, tmppath); |
1215 |
pjob->ji_qs.ji_jobid, tmppath); |
|
Lines 1231-1237
Link Here
|
| 1231 |
|
1240 |
|
| 1232 |
fclose(fd); |
1241 |
fclose(fd); |
| 1233 |
#ifdef NUMA_SUPPORT |
1242 |
#ifdef NUMA_SUPPORT |
| 1234 |
snprintf(tmppath,sizeof(tmppath),"%s/mems",path); |
1243 |
snprintf(tmppath,sizeof(tmppath),"%s/%smems",path, CPUSET_PREFIX); |
| 1235 |
fd = fopen(tmppath, "w"); |
1244 |
fd = fopen(tmppath, "w"); |
| 1236 |
if (fd) |
1245 |
if (fd) |
| 1237 |
{ |
1246 |
{ |
|
Lines 1705-1711
Link Here
|
| 1705 |
|
1714 |
|
| 1706 |
if (LOGLEVEL >= 6) |
1715 |
if (LOGLEVEL >= 6) |
| 1707 |
{ |
1716 |
{ |
| 1708 |
sprintf(log_buffer, "cpuset %s/memory_pressure=%d", path, rc); |
1717 |
sprintf(log_buffer, "cpuset %s/%smemory_pressure=%d", path, CPUSET_PREFIX, rc); |
| 1709 |
log_record(PBSEVENT_DEBUG, 0, id, log_buffer); |
1718 |
log_record(PBSEVENT_DEBUG, 0, id, log_buffer); |
| 1710 |
} |
1719 |
} |
| 1711 |
|
1720 |
|
|
Lines 1714-1722
Link Here
|
| 1714 |
/* Construct the name of the cpuset's memory_pressure file */ |
1723 |
/* Construct the name of the cpuset's memory_pressure file */ |
| 1715 |
|
1724 |
|
| 1716 |
if (cpusetname[0] == '/') |
1725 |
if (cpusetname[0] == '/') |
| 1717 |
snprintf(path, sizeof(path), "%s/memory_pressure", cpusetname); |
1726 |
snprintf(path, sizeof(path), "%s/%smemory_pressure", cpusetname, CPUSET_PREFIX); |
| 1718 |
else |
1727 |
else |
| 1719 |
snprintf(path, sizeof(path), "%s/%s/memory_pressure", TTORQUECPUSET_PATH, cpusetname); |
1728 |
snprintf(path, sizeof(path), "%s/%s/%smemory_pressure", TTORQUECPUSET_PATH, |
|
|
1729 |
cpusetname, CPUSET_PREFIX); |
| 1720 |
|
1730 |
|
| 1721 |
/* Open, read, close */ |
1731 |
/* Open, read, close */ |
| 1722 |
|
1732 |
|