|
@@ -564,6 +564,32 @@ static int __rdtgroup_move_task(struct task_struct *tsk,
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * rdtgroup_tasks_assigned - Test if tasks have been assigned to resource group
|
|
|
+ * @r: Resource group
|
|
|
+ *
|
|
|
+ * Return: 1 if tasks have been assigned to @r, 0 otherwise
|
|
|
+ */
|
|
|
+int rdtgroup_tasks_assigned(struct rdtgroup *r)
|
|
|
+{
|
|
|
+ struct task_struct *p, *t;
|
|
|
+ int ret = 0;
|
|
|
+
|
|
|
+ lockdep_assert_held(&rdtgroup_mutex);
|
|
|
+
|
|
|
+ rcu_read_lock();
|
|
|
+ for_each_process_thread(p, t) {
|
|
|
+ if ((r->type == RDTCTRL_GROUP && t->closid == r->closid) ||
|
|
|
+ (r->type == RDTMON_GROUP && t->rmid == r->mon.rmid)) {
|
|
|
+ ret = 1;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ rcu_read_unlock();
|
|
|
+
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
static int rdtgroup_task_write_permission(struct task_struct *task,
|
|
|
struct kernfs_open_file *of)
|
|
|
{
|