[PATCHv5 10/19] util: Introduce default monitor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In resctrl file system, more than one monitoring groups
could be created within one allocation group, along with
the creation of allocation group, a monitoring group is
created at the same, which monitors the resource
utilization information of whole allocation group.

This patch is introducing the concept of default monitor,
which represents the particular monitoring group that
created along with the creation of allocation group.

Default monitor shares the common 'vcpu' list with the
allocation.

Signed-off-by: Wang Huaqiang <huaqiang.wang@xxxxxxxxx>
---
 src/libvirt_private.syms |  1 +
 src/util/virresctrl.c    | 23 +++++++++++++++++++++++
 src/util/virresctrl.h    |  2 ++
 3 files changed, 26 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index c93d19f..4b22ed4 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2689,6 +2689,7 @@ virResctrlMonitorGetID;
 virResctrlMonitorNew;
 virResctrlMonitorRemove;
 virResctrlMonitorSetCacheLevel;
+virResctrlMonitorSetDefault;
 virResctrlMonitorSetID;
 
 
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index fca1f6f..41e8d48 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -340,6 +340,13 @@ struct _virResctrlAlloc {
  * bandwidth technology (MBM), as well as the CAT and MBA, are all orthogonal
  * features. The monitor will be created under the scope of default allocation
  * if no CAT or MBA supported in the system.
+ *
+ * In resctrl file sytem, more than one monitoring groups could be created
+ * within one allocation group, along with the creation of allocation group,
+ * a monitoring group is created at the same, which monitors the resource
+ * utilization information of whole allocation group.
+ * A virResctrlMonitor with @default_monitor marked as 'true' is representing
+ * the monitoring group created along with the creation of allocation group.
  */
 struct _virResctrlMonitor {
     virObject parent;
@@ -355,6 +362,8 @@ struct _virResctrlMonitor {
     /* libvirt-generated path in /sys/fs/resctrl for this particular
      * monitor */
     char *path;
+    /* Boolean flag for default monitor */
+    bool default_monitor;
     /* The cache 'level', special for cache monitor */
     unsigned int cache_level;
 };
@@ -2499,6 +2508,13 @@ virResctrlMonitorDeterminePath(virResctrlMonitorPtr monitor,
         return -1;
     }
 
+    if (monitor->default_monitor) {
+        if (VIR_STRDUP(monitor->path, monitor->alloc->path) < 0)
+            return -1;
+
+        return 0;
+    }
+
     if (monitor->alloc)
         alloc_path = monitor->alloc->path;
     else
@@ -2739,3 +2755,10 @@ virResctrlMonitorGetCacheOccupancy(virResctrlMonitorPtr monitor,
     return virResctrlMonitorGetStatistic(monitor, "llc_occupancy",
                                          nbank, bankids, bankcaches);
 }
+
+
+void
+virResctrlMonitorSetDefault(virResctrlMonitorPtr monitor)
+{
+    monitor->default_monitor = true;
+}
diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h
index 6137fee..371df8a 100644
--- a/src/util/virresctrl.h
+++ b/src/util/virresctrl.h
@@ -228,4 +228,6 @@ virResctrlMonitorGetCacheOccupancy(virResctrlMonitorPtr monitor,
                                    size_t *nbank,
                                    unsigned int **bankids,
                                    unsigned int **bankcaches);
+void
+virResctrlMonitorSetDefault(virResctrlMonitorPtr monitor);
 #endif /*  __VIR_RESCTRL_H__ */
-- 
2.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux