[libvirt] [v7 00/10] Support cache tune in libvirt

Marcelo Tosatti mtosatti at redhat.com
Sun Feb 19 14:51:46 UTC 2017


Hi Eli Qiao,

Question about removing resctrlfs directories with empty "tasks" file.


            /* This domain is not created by libvirt, so we don't care
             * about the tasks, add a fake one to prevent
             * virResCtrlRefresh
             * remove it from sysfs */
            virResCtrlAddTask(p, 1);
            virResCtrlAppendDomain(p);

/* Refresh all domains', remove the domains which has no task ids.
 * This will be used after VM pause, restart, destroy etc.
 */
static int
virResCtrlRefresh(void)

Why are you doing this (removing directories which have no tasks in
them) ? The code should only read information from other
CAT reservations, not write to them.


This is not for cleanup purposes, since on VM shutdown the resctrlfs 
directories are properly removed:

/* Remove the Domain from sysfs, this should only success no pids in
 * tasks
 * of a partition.
 */
static
int virResCtrlRemoveDomain(const char *name)
{
    char *path = NULL;
    int rc = 0;

    if ((rc = virAsprintf(&path, "%s/%s", RESCTRL_DIR, name)) < 0)
        return rc;
    rc = rmdir(path);
    VIR_FREE(path);
    return rc;
}

Should not write to other directories 'tasks' file.




More information about the libvir-list mailing list