Lines Matching refs:rdtgrp

157 	struct rdtgroup *rdtgrp;  in rdtgroup_mode_by_closid()  local
159 list_for_each_entry(rdtgrp, &rdt_all_groups, rdtgroup_list) { in rdtgroup_mode_by_closid()
160 if (rdtgrp->closid == closid) in rdtgroup_mode_by_closid()
161 return rdtgrp->mode; in rdtgroup_mode_by_closid()
264 struct rdtgroup *rdtgrp; in rdtgroup_cpus_show() local
268 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_cpus_show()
270 if (rdtgrp) { in rdtgroup_cpus_show()
271 if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) { in rdtgroup_cpus_show()
272 if (!rdtgrp->plr->d) { in rdtgroup_cpus_show()
277 mask = &rdtgrp->plr->d->cpu_mask; in rdtgroup_cpus_show()
284 cpumask_pr_args(&rdtgrp->cpu_mask)); in rdtgroup_cpus_show()
333 static int cpus_mon_write(struct rdtgroup *rdtgrp, cpumask_var_t newmask, in cpus_mon_write() argument
336 struct rdtgroup *prgrp = rdtgrp->mon.parent, *crgrp; in cpus_mon_write()
347 cpumask_andnot(tmpmask, &rdtgrp->cpu_mask, newmask); in cpus_mon_write()
358 cpumask_andnot(tmpmask, newmask, &rdtgrp->cpu_mask); in cpus_mon_write()
362 if (crgrp == rdtgrp) in cpus_mon_write()
367 update_closid_rmid(tmpmask, rdtgrp); in cpus_mon_write()
371 cpumask_copy(&rdtgrp->cpu_mask, newmask); in cpus_mon_write()
386 static int cpus_ctrl_write(struct rdtgroup *rdtgrp, cpumask_var_t newmask, in cpus_ctrl_write() argument
393 cpumask_andnot(tmpmask, &rdtgrp->cpu_mask, newmask); in cpus_ctrl_write()
396 if (rdtgrp == &rdtgroup_default) { in cpus_ctrl_write()
412 cpumask_andnot(tmpmask, newmask, &rdtgrp->cpu_mask); in cpus_ctrl_write()
415 if (r == rdtgrp) in cpus_ctrl_write()
421 update_closid_rmid(tmpmask, rdtgrp); in cpus_ctrl_write()
425 cpumask_copy(&rdtgrp->cpu_mask, newmask); in cpus_ctrl_write()
431 head = &rdtgrp->mon.crdtgrp_list; in cpus_ctrl_write()
433 cpumask_and(tmpmask, &rdtgrp->cpu_mask, &crgrp->cpu_mask); in cpus_ctrl_write()
434 update_closid_rmid(tmpmask, rdtgrp); in cpus_ctrl_write()
445 struct rdtgroup *rdtgrp; in rdtgroup_cpus_write() local
463 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_cpus_write()
464 if (!rdtgrp) { in rdtgroup_cpus_write()
469 if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED || in rdtgroup_cpus_write()
470 rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) { in rdtgroup_cpus_write()
494 if (rdtgrp->type == RDTCTRL_GROUP) in rdtgroup_cpus_write()
495 ret = cpus_ctrl_write(rdtgrp, newmask, tmpmask, tmpmask1); in rdtgroup_cpus_write()
496 else if (rdtgrp->type == RDTMON_GROUP) in rdtgroup_cpus_write()
497 ret = cpus_mon_write(rdtgrp, newmask, tmpmask); in rdtgroup_cpus_write()
522 static void rdtgroup_remove(struct rdtgroup *rdtgrp) in rdtgroup_remove() argument
524 kernfs_put(rdtgrp->kn); in rdtgroup_remove()
525 kfree(rdtgrp); in rdtgroup_remove()
530 struct rdtgroup *rdtgrp; member
536 struct rdtgroup *rdtgrp; in move_myself() local
539 rdtgrp = callback->rdtgrp; in move_myself()
546 if (atomic_dec_and_test(&rdtgrp->waitcount) && in move_myself()
547 (rdtgrp->flags & RDT_DELETED)) { in move_myself()
550 rdtgroup_remove(rdtgrp); in move_myself()
566 struct rdtgroup *rdtgrp) in __rdtgroup_move_task() argument
575 callback->rdtgrp = rdtgrp; in __rdtgroup_move_task()
581 atomic_inc(&rdtgrp->waitcount); in __rdtgroup_move_task()
589 atomic_dec(&rdtgrp->waitcount); in __rdtgroup_move_task()
598 if (rdtgrp->type == RDTCTRL_GROUP) { in __rdtgroup_move_task()
599 tsk->closid = rdtgrp->closid; in __rdtgroup_move_task()
600 tsk->rmid = rdtgrp->mon.rmid; in __rdtgroup_move_task()
601 } else if (rdtgrp->type == RDTMON_GROUP) { in __rdtgroup_move_task()
602 if (rdtgrp->mon.parent->closid == tsk->closid) { in __rdtgroup_move_task()
603 tsk->rmid = rdtgrp->mon.rmid; in __rdtgroup_move_task()
672 static int rdtgroup_move_task(pid_t pid, struct rdtgroup *rdtgrp, in rdtgroup_move_task() argument
695 ret = __rdtgroup_move_task(tsk, rdtgrp); in rdtgroup_move_task()
704 struct rdtgroup *rdtgrp; in rdtgroup_tasks_write() local
710 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_tasks_write()
711 if (!rdtgrp) { in rdtgroup_tasks_write()
717 if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED || in rdtgroup_tasks_write()
718 rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) { in rdtgroup_tasks_write()
724 ret = rdtgroup_move_task(pid, rdtgrp, of); in rdtgroup_tasks_write()
747 struct rdtgroup *rdtgrp; in rdtgroup_tasks_show() local
750 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_tasks_show()
751 if (rdtgrp) in rdtgroup_tasks_show()
752 show_rdt_tasks(rdtgrp, s); in rdtgroup_tasks_show()
1086 struct rdtgroup *rdtgrp; in rdtgroup_mode_show() local
1088 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_mode_show()
1089 if (!rdtgrp) { in rdtgroup_mode_show()
1094 seq_printf(s, "%s\n", rdtgroup_mode_str(rdtgrp->mode)); in rdtgroup_mode_show()
1275 static bool rdtgroup_mode_test_exclusive(struct rdtgroup *rdtgrp) in rdtgroup_mode_test_exclusive() argument
1277 int closid = rdtgrp->closid; in rdtgroup_mode_test_exclusive()
1288 rdtgrp->closid, false)) { in rdtgroup_mode_test_exclusive()
1310 struct rdtgroup *rdtgrp; in rdtgroup_mode_write() local
1319 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_mode_write()
1320 if (!rdtgrp) { in rdtgroup_mode_write()
1327 mode = rdtgrp->mode; in rdtgroup_mode_write()
1343 if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) { in rdtgroup_mode_write()
1344 ret = rdtgroup_locksetup_exit(rdtgrp); in rdtgroup_mode_write()
1348 rdtgrp->mode = RDT_MODE_SHAREABLE; in rdtgroup_mode_write()
1350 if (!rdtgroup_mode_test_exclusive(rdtgrp)) { in rdtgroup_mode_write()
1354 if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) { in rdtgroup_mode_write()
1355 ret = rdtgroup_locksetup_exit(rdtgrp); in rdtgroup_mode_write()
1359 rdtgrp->mode = RDT_MODE_EXCLUSIVE; in rdtgroup_mode_write()
1361 ret = rdtgroup_locksetup_enter(rdtgrp); in rdtgroup_mode_write()
1364 rdtgrp->mode = RDT_MODE_PSEUDO_LOCKSETUP; in rdtgroup_mode_write()
1419 struct rdtgroup *rdtgrp; in rdtgroup_size_show() local
1427 rdtgrp = rdtgroup_kn_lock_live(of->kn); in rdtgroup_size_show()
1428 if (!rdtgrp) { in rdtgroup_size_show()
1433 if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) { in rdtgroup_size_show()
1434 if (!rdtgrp->plr->d) { in rdtgroup_size_show()
1440 rdtgrp->plr->r->name); in rdtgroup_size_show()
1441 size = rdtgroup_cbm_to_size(rdtgrp->plr->r, in rdtgroup_size_show()
1442 rdtgrp->plr->d, in rdtgroup_size_show()
1443 rdtgrp->plr->cbm); in rdtgroup_size_show()
1444 seq_printf(s, "%d=%u\n", rdtgrp->plr->d->id, size); in rdtgroup_size_show()
1455 if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) { in rdtgroup_size_show()
1459 d->ctrl_val[rdtgrp->closid] : in rdtgroup_size_show()
1460 d->mbps_val[rdtgrp->closid]); in rdtgroup_size_show()
2059 struct rdtgroup *rdtgrp = kernfs_to_rdtgroup(kn); in rdtgroup_kn_lock_live() local
2061 if (!rdtgrp) in rdtgroup_kn_lock_live()
2064 atomic_inc(&rdtgrp->waitcount); in rdtgroup_kn_lock_live()
2070 if (rdtgrp->flags & RDT_DELETED) in rdtgroup_kn_lock_live()
2073 return rdtgrp; in rdtgroup_kn_lock_live()
2078 struct rdtgroup *rdtgrp = kernfs_to_rdtgroup(kn); in rdtgroup_kn_unlock() local
2080 if (!rdtgrp) in rdtgroup_kn_unlock()
2085 if (atomic_dec_and_test(&rdtgrp->waitcount) && in rdtgroup_kn_unlock()
2086 (rdtgrp->flags & RDT_DELETED)) { in rdtgroup_kn_unlock()
2087 if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP || in rdtgroup_kn_unlock()
2088 rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) in rdtgroup_kn_unlock()
2089 rdtgroup_pseudo_lock_remove(rdtgrp); in rdtgroup_kn_unlock()
2091 rdtgroup_remove(rdtgrp); in rdtgroup_kn_unlock()
2353 static void free_all_child_rdtgrp(struct rdtgroup *rdtgrp) in free_all_child_rdtgrp() argument
2358 head = &rdtgrp->mon.crdtgrp_list; in free_all_child_rdtgrp()
2375 struct rdtgroup *rdtgrp, *tmp; in rmdir_all_sub() local
2380 list_for_each_entry_safe(rdtgrp, tmp, &rdt_all_groups, rdtgroup_list) { in rmdir_all_sub()
2382 free_all_child_rdtgrp(rdtgrp); in rmdir_all_sub()
2385 if (rdtgrp == &rdtgroup_default) in rmdir_all_sub()
2388 if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP || in rmdir_all_sub()
2389 rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) in rmdir_all_sub()
2390 rdtgroup_pseudo_lock_remove(rdtgrp); in rmdir_all_sub()
2398 &rdtgroup_default.cpu_mask, &rdtgrp->cpu_mask); in rmdir_all_sub()
2400 free_rmid(rdtgrp->mon.rmid); in rmdir_all_sub()
2402 kernfs_remove(rdtgrp->kn); in rmdir_all_sub()
2403 list_del(&rdtgrp->rdtgroup_list); in rmdir_all_sub()
2405 if (atomic_read(&rdtgrp->waitcount) != 0) in rmdir_all_sub()
2406 rdtgrp->flags = RDT_DELETED; in rmdir_all_sub()
2408 rdtgroup_remove(rdtgrp); in rmdir_all_sub()
2768 static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp) in rdtgroup_init_alloc() argument
2777 ret = rdtgroup_init_cat(r, rdtgrp->closid); in rdtgroup_init_alloc()
2782 ret = update_domains(r, rdtgrp->closid); in rdtgroup_init_alloc()
2790 rdtgrp->mode = RDT_MODE_SHAREABLE; in rdtgroup_init_alloc()
2799 struct rdtgroup *prdtgrp, *rdtgrp; in mkdir_rdt_prepare() local
2819 rdtgrp = kzalloc(sizeof(*rdtgrp), GFP_KERNEL); in mkdir_rdt_prepare()
2820 if (!rdtgrp) { in mkdir_rdt_prepare()
2825 *r = rdtgrp; in mkdir_rdt_prepare()
2826 rdtgrp->mon.parent = prdtgrp; in mkdir_rdt_prepare()
2827 rdtgrp->type = rtype; in mkdir_rdt_prepare()
2828 INIT_LIST_HEAD(&rdtgrp->mon.crdtgrp_list); in mkdir_rdt_prepare()
2831 kn = kernfs_create_dir(parent_kn, name, mode, rdtgrp); in mkdir_rdt_prepare()
2837 rdtgrp->kn = kn; in mkdir_rdt_prepare()
2866 rdtgrp->mon.rmid = ret; in mkdir_rdt_prepare()
2868 ret = mkdir_mondata_all(kn, rdtgrp, &rdtgrp->mon.mon_data_kn); in mkdir_rdt_prepare()
2882 free_rmid(rdtgrp->mon.rmid); in mkdir_rdt_prepare()
2884 kernfs_put(rdtgrp->kn); in mkdir_rdt_prepare()
2885 kernfs_remove(rdtgrp->kn); in mkdir_rdt_prepare()
2887 kfree(rdtgrp); in mkdir_rdt_prepare()
2908 struct rdtgroup *rdtgrp, *prgrp; in rdtgroup_mkdir_mon() local
2911 ret = mkdir_rdt_prepare(parent_kn, name, mode, RDTMON_GROUP, &rdtgrp); in rdtgroup_mkdir_mon()
2915 prgrp = rdtgrp->mon.parent; in rdtgroup_mkdir_mon()
2916 rdtgrp->closid = prgrp->closid; in rdtgroup_mkdir_mon()
2922 list_add_tail(&rdtgrp->mon.crdtgrp_list, &prgrp->mon.crdtgrp_list); in rdtgroup_mkdir_mon()
2935 struct rdtgroup *rdtgrp; in rdtgroup_mkdir_ctrl_mon() local
2940 ret = mkdir_rdt_prepare(parent_kn, name, mode, RDTCTRL_GROUP, &rdtgrp); in rdtgroup_mkdir_ctrl_mon()
2944 kn = rdtgrp->kn; in rdtgroup_mkdir_ctrl_mon()
2953 rdtgrp->closid = closid; in rdtgroup_mkdir_ctrl_mon()
2954 ret = rdtgroup_init_alloc(rdtgrp); in rdtgroup_mkdir_ctrl_mon()
2958 list_add(&rdtgrp->rdtgroup_list, &rdt_all_groups); in rdtgroup_mkdir_ctrl_mon()
2965 ret = mongroup_create_dir(kn, rdtgrp, "mon_groups", NULL); in rdtgroup_mkdir_ctrl_mon()
2975 list_del(&rdtgrp->rdtgroup_list); in rdtgroup_mkdir_ctrl_mon()
2979 mkdir_rdt_prepare_clean(rdtgrp); in rdtgroup_mkdir_ctrl_mon()
3026 static int rdtgroup_rmdir_mon(struct kernfs_node *kn, struct rdtgroup *rdtgrp, in rdtgroup_rmdir_mon() argument
3029 struct rdtgroup *prdtgrp = rdtgrp->mon.parent; in rdtgroup_rmdir_mon()
3033 rdt_move_group_tasks(rdtgrp, prdtgrp, tmpmask); in rdtgroup_rmdir_mon()
3036 for_each_cpu(cpu, &rdtgrp->cpu_mask) in rdtgroup_rmdir_mon()
3042 cpumask_or(tmpmask, tmpmask, &rdtgrp->cpu_mask); in rdtgroup_rmdir_mon()
3045 rdtgrp->flags = RDT_DELETED; in rdtgroup_rmdir_mon()
3046 free_rmid(rdtgrp->mon.rmid); in rdtgroup_rmdir_mon()
3052 list_del(&rdtgrp->mon.crdtgrp_list); in rdtgroup_rmdir_mon()
3054 kernfs_remove(rdtgrp->kn); in rdtgroup_rmdir_mon()
3060 struct rdtgroup *rdtgrp) in rdtgroup_ctrl_remove() argument
3062 rdtgrp->flags = RDT_DELETED; in rdtgroup_ctrl_remove()
3063 list_del(&rdtgrp->rdtgroup_list); in rdtgroup_ctrl_remove()
3065 kernfs_remove(rdtgrp->kn); in rdtgroup_ctrl_remove()
3069 static int rdtgroup_rmdir_ctrl(struct kernfs_node *kn, struct rdtgroup *rdtgrp, in rdtgroup_rmdir_ctrl() argument
3075 rdt_move_group_tasks(rdtgrp, &rdtgroup_default, tmpmask); in rdtgroup_rmdir_ctrl()
3079 &rdtgroup_default.cpu_mask, &rdtgrp->cpu_mask); in rdtgroup_rmdir_ctrl()
3082 for_each_cpu(cpu, &rdtgrp->cpu_mask) { in rdtgroup_rmdir_ctrl()
3091 cpumask_or(tmpmask, tmpmask, &rdtgrp->cpu_mask); in rdtgroup_rmdir_ctrl()
3094 closid_free(rdtgrp->closid); in rdtgroup_rmdir_ctrl()
3095 free_rmid(rdtgrp->mon.rmid); in rdtgroup_rmdir_ctrl()
3097 rdtgroup_ctrl_remove(kn, rdtgrp); in rdtgroup_rmdir_ctrl()
3102 free_all_child_rdtgrp(rdtgrp); in rdtgroup_rmdir_ctrl()
3110 struct rdtgroup *rdtgrp; in rdtgroup_rmdir() local
3117 rdtgrp = rdtgroup_kn_lock_live(kn); in rdtgroup_rmdir()
3118 if (!rdtgrp) { in rdtgroup_rmdir()
3130 if (rdtgrp->type == RDTCTRL_GROUP && parent_kn == rdtgroup_default.kn && in rdtgroup_rmdir()
3131 rdtgrp != &rdtgroup_default) { in rdtgroup_rmdir()
3132 if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP || in rdtgroup_rmdir()
3133 rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) { in rdtgroup_rmdir()
3134 ret = rdtgroup_ctrl_remove(kn, rdtgrp); in rdtgroup_rmdir()
3136 ret = rdtgroup_rmdir_ctrl(kn, rdtgrp, tmpmask); in rdtgroup_rmdir()
3138 } else if (rdtgrp->type == RDTMON_GROUP && in rdtgroup_rmdir()
3140 ret = rdtgroup_rmdir_mon(kn, rdtgrp, tmpmask); in rdtgroup_rmdir()