cgroup: Reset cacheqos RMID on task exit

We need to clear the associated RMID (if any) when a task exits,
otherwise the value will not reflect reality as any subsequent task that
runs after the first task exits will skew the occupancy data value.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
diff --git a/kernel/events/core.c b/kernel/events/core.c
index fa0b2d4..20bcda3 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7488,6 +7488,11 @@
 
 	for_each_task_context_nr(ctxn)
 		perf_event_exit_task_context(child, ctxn);
+
+#ifdef CONFIG_CGROUP_CACHEQOS
+	/* use outgoing task to see if cacheqos is active or not */
+	cacheqos_sched_out(child);
+#endif /* CONFIG_CGROUP_CACHEQOS */
 }
 
 static void perf_free_event(struct perf_event *event,