cpusetSetMemLimits(3x)cpusetSetMemLimits(3x)NAMEcpusetSetMemLimits - set the memory size limits for a cpuset
SYNOPSIS
#include <cpuset.h>
int cpusetSetMemLimits(cpuset_QueueDef_t *qdef, uint64_t advisory,
uint64_t mandatory);
DESCRIPTION
The cpusetSetMemLimits function is used to set the advisory and mandatory
memory sizes that will constrain the conditions under which the cpuset
will be created. The advisory and mandatory memory size limits will be
copied into a memory location referenced by the qdef argument. Consult
the cpusetAllocQueueDef(3x) man page for additional information about the
cpuset_QueueDef_t type.
The advisory limit indicates that if the aggregrate amount of memory on
all the nodes in the cpuset is below that limit, a warning will be set in
errno, but the cpuset will be created. The mandatory limit indicates
that if the aggregate amount of memory on all the nodes in the cpuset is
below that limit, this results in a failure condition being set in
errno, and the cpuset will fail to be created. Both of these limit
conditions are checked at cpuset creation time, and the warning or error
condition will be occur during the call to cpusetCreate(3x)..
The return value of the function indicates if the function was
successfully executed.
EXAMPLES
This example prints out the advisory and mandatory memory sizes used when
creating the cpuset mpi_set.
char *qname = "mpi_set";
cpuset_QueueDef_t *qdef = NULL;
int memadv = 128000000;
int memman = 64000000;
/* Alloc queue definition structure, for 10 CPUs */
qdef = cpusetAllocQueueDef(10);
/* Set the limits else print error & exit */
if (!cpusetSetMemLimits(qdef, memadv, memman)) ) {
perror("cpusetSetMemLimits");
exit(1);
}
...... /* Set all the other attributes for cpuset */
if (!cpusetCreate(qdef)) {
perror("cpusetCreate");
exit(1);
}
if (errno == EMEMWARN) {
printf("Memory: %s\n", strerror(errno));
Page 1
cpusetSetMemLimits(3x)cpusetSetMemLimits(3x)
}
NOTEScpusetSetMemLimits is found in the library "libcpuset.so", and will be
loaded if the option -lcpuset is used with cc(1) or ld(1).
SEE ALSOcpuset(1), cpusetAllocQueueDef(3x), cpusetCreate(3x),
cpusetGetMemLimits(3x), cpuset(5).
DIAGNOSTICS
If successful, cpusetSetMemLimits returns 1. If cpusetSetMemLimits
fails, it returns 0 and errno is set to indicate the error.
Page 2