* in case there is no allocation for that particular cache allocation (level,
* cache, ...) or memory allocation for particular node).
*
+ * Allocation corresponding to root directory, /sys/fs/sysctrl/, defines the
+ * default resource allocating policy, which is created immediately after
+ * mounting, and owns all the tasks and cpus in the system. Cache or memory
+ * bandwidth resource will be shared for tasks in this allocation.
+ *
* =====Cache allocation technology (CAT)=====
*
* Since one allocation can be made for caches on different levels, the first
return -1;
}
+ /* If the allocation is empty, then the path will be SYSFS_RESCTRL_PATH */
+ if (virResctrlAllocIsEmpty(alloc)) {
+ if (!alloc->path &&
+ VIR_STRDUP(alloc->path, SYSFS_RESCTRL_PATH) < 0)
+ return -1;
+
+ return 0;
+ }
+
if (!alloc->path &&
virAsprintf(&alloc->path, "%s/%s-%s",
SYSFS_RESCTRL_PATH, machinename, alloc->id) < 0)
if (virResctrlAllocDeterminePath(alloc, machinename) < 0)
return -1;
+ /* If using the system/default path for the allocation, then we're done */
+ if (STREQ(alloc->path, SYSFS_RESCTRL_PATH))
+ return 0;
+
if (virFileExists(alloc->path)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Path '%s' for resctrl allocation exists"),
char *pidstr = NULL;
int ret = 0;
+ /* If the allocation is empty, then it is impossible to add a PID to
+ * allocation due to lacking of its 'tasks' file so just return */
+ if (virResctrlAllocIsEmpty(alloc))
+ return 0;
+
if (!alloc->path) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot add pid to non-existing resctrl allocation"));
if (!alloc->path)
return 0;
+ /* Do not destroy if path is the system/default path for the allocation */
+ if (STREQ(alloc->path, SYSFS_RESCTRL_PATH))
+ return 0;
+
VIR_DEBUG("Removing resctrl allocation %s", alloc->path);
if (rmdir(alloc->path) != 0 && errno != ENOENT) {
ret = -errno;