Lines Matching full:thresholds
1416 t = rcu_dereference(memcg->thresholds.primary); in __mem_cgroup_threshold()
1433 * Iterate backward over array of thresholds starting from in __mem_cgroup_threshold()
1435 * If none of thresholds below usage is crossed, we read in __mem_cgroup_threshold()
1445 * Iterate forward over array of thresholds starting from in __mem_cgroup_threshold()
1447 * If none of thresholds above usage is crossed, we read in __mem_cgroup_threshold()
1614 struct mem_cgroup_thresholds *thresholds; in __mem_cgroup_usage_register_event() local
1627 thresholds = &memcg->thresholds; in __mem_cgroup_usage_register_event()
1630 thresholds = &memcg->memsw_thresholds; in __mem_cgroup_usage_register_event()
1636 if (thresholds->primary) in __mem_cgroup_usage_register_event()
1639 size = thresholds->primary ? thresholds->primary->size + 1 : 1; in __mem_cgroup_usage_register_event()
1641 /* Allocate memory for new array of thresholds */ in __mem_cgroup_usage_register_event()
1649 /* Copy thresholds (if any) to new array */ in __mem_cgroup_usage_register_event()
1650 if (thresholds->primary) in __mem_cgroup_usage_register_event()
1651 memcpy(new->entries, thresholds->primary->entries, in __mem_cgroup_usage_register_event()
1658 /* Sort thresholds. Registering of new threshold isn't time-critical */ in __mem_cgroup_usage_register_event()
1677 kfree(thresholds->spare); in __mem_cgroup_usage_register_event()
1678 thresholds->spare = thresholds->primary; in __mem_cgroup_usage_register_event()
1680 rcu_assign_pointer(thresholds->primary, new); in __mem_cgroup_usage_register_event()
1682 /* To be sure that nobody uses thresholds */ in __mem_cgroup_usage_register_event()
1706 struct mem_cgroup_thresholds *thresholds; in __mem_cgroup_usage_unregister_event() local
1714 thresholds = &memcg->thresholds; in __mem_cgroup_usage_unregister_event()
1717 thresholds = &memcg->memsw_thresholds; in __mem_cgroup_usage_unregister_event()
1722 if (!thresholds->primary) in __mem_cgroup_usage_unregister_event()
1730 for (i = 0; i < thresholds->primary->size; i++) { in __mem_cgroup_usage_unregister_event()
1731 if (thresholds->primary->entries[i].eventfd != eventfd) in __mem_cgroup_usage_unregister_event()
1737 new = thresholds->spare; in __mem_cgroup_usage_unregister_event()
1743 /* Set thresholds array to NULL if we don't have thresholds */ in __mem_cgroup_usage_unregister_event()
1752 /* Copy thresholds and find current threshold */ in __mem_cgroup_usage_unregister_event()
1754 for (i = 0, j = 0; i < thresholds->primary->size; i++) { in __mem_cgroup_usage_unregister_event()
1755 if (thresholds->primary->entries[i].eventfd == eventfd) in __mem_cgroup_usage_unregister_event()
1758 new->entries[j] = thresholds->primary->entries[i]; in __mem_cgroup_usage_unregister_event()
1772 thresholds->spare = thresholds->primary; in __mem_cgroup_usage_unregister_event()
1774 rcu_assign_pointer(thresholds->primary, new); in __mem_cgroup_usage_unregister_event()
1776 /* To be sure that nobody uses thresholds */ in __mem_cgroup_usage_unregister_event()
1781 kfree(thresholds->spare); in __mem_cgroup_usage_unregister_event()
1782 thresholds->spare = NULL; in __mem_cgroup_usage_unregister_event()