Lines Matching refs:memcg

140 	struct mem_cgroup	*memcg;		/* Back pointer, we cannot */  member
195 struct mem_cgroup *memcg; member
370 return READ_ONCE(objcg->memcg); in obj_cgroup_memcg()
528 struct mem_cgroup *memcg; in get_mem_cgroup_from_objcg() local
532 memcg = obj_cgroup_memcg(objcg); in get_mem_cgroup_from_objcg()
533 if (unlikely(!css_tryget(&memcg->css))) in get_mem_cgroup_from_objcg()
537 return memcg; in get_mem_cgroup_from_objcg()
570 static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg) in mem_cgroup_is_root() argument
572 return (memcg == root_mem_cgroup); in mem_cgroup_is_root()
581 struct mem_cgroup *memcg, in mem_cgroup_protection() argument
623 if (root == memcg) in mem_cgroup_protection()
626 *min = READ_ONCE(memcg->memory.emin); in mem_cgroup_protection()
627 *low = READ_ONCE(memcg->memory.elow); in mem_cgroup_protection()
631 struct mem_cgroup *memcg);
634 struct mem_cgroup *memcg) in mem_cgroup_unprotected() argument
641 return mem_cgroup_disabled() || mem_cgroup_is_root(memcg) || in mem_cgroup_unprotected()
642 memcg == target; in mem_cgroup_unprotected()
646 struct mem_cgroup *memcg) in mem_cgroup_below_low() argument
648 if (mem_cgroup_unprotected(target, memcg)) in mem_cgroup_below_low()
651 return READ_ONCE(memcg->memory.elow) >= in mem_cgroup_below_low()
652 page_counter_read(&memcg->memory); in mem_cgroup_below_low()
656 struct mem_cgroup *memcg) in mem_cgroup_below_min() argument
658 if (mem_cgroup_unprotected(target, memcg)) in mem_cgroup_below_min()
661 return READ_ONCE(memcg->memory.emin) >= in mem_cgroup_below_min()
662 page_counter_read(&memcg->memory); in mem_cgroup_below_min()
727 static inline struct lruvec *mem_cgroup_lruvec(struct mem_cgroup *memcg, in mem_cgroup_lruvec() argument
738 if (!memcg) in mem_cgroup_lruvec()
739 memcg = root_mem_cgroup; in mem_cgroup_lruvec()
741 mz = memcg->nodeinfo[pgdat->node_id]; in mem_cgroup_lruvec()
762 struct mem_cgroup *memcg = folio_memcg(folio); in folio_lruvec() local
764 VM_WARN_ON_ONCE_FOLIO(!memcg && !mem_cgroup_disabled(), folio); in folio_lruvec()
765 return mem_cgroup_lruvec(memcg, folio_pgdat(folio)); in folio_lruvec()
812 static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg) in mem_cgroup_tryget() argument
814 return !memcg || css_tryget(&memcg->css); in mem_cgroup_tryget()
817 static inline void mem_cgroup_put(struct mem_cgroup *memcg) in mem_cgroup_put() argument
819 if (memcg) in mem_cgroup_put()
820 css_put(&memcg->css); in mem_cgroup_put()
830 void mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
833 static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg) in mem_cgroup_id() argument
838 return memcg->id.id; in mem_cgroup_id()
843 static inline unsigned long mem_cgroup_ino(struct mem_cgroup *memcg) in mem_cgroup_ino() argument
845 return memcg ? cgroup_ino(memcg->css.cgroup) : 0; in mem_cgroup_ino()
864 return mz->memcg; in lruvec_memcg()
873 static inline struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg) in parent_mem_cgroup() argument
875 return mem_cgroup_from_css(memcg->css.parent); in parent_mem_cgroup()
878 static inline bool mem_cgroup_is_descendant(struct mem_cgroup *memcg, in mem_cgroup_is_descendant() argument
881 if (root == memcg) in mem_cgroup_is_descendant()
883 return cgroup_is_descendant(memcg->css.cgroup, root->css.cgroup); in mem_cgroup_is_descendant()
887 struct mem_cgroup *memcg) in mm_match_cgroup() argument
895 match = mem_cgroup_is_descendant(task_memcg, memcg); in mm_match_cgroup()
903 static inline bool mem_cgroup_online(struct mem_cgroup *memcg) in mem_cgroup_online() argument
907 return !!(memcg->css.flags & CSS_ONLINE); in mem_cgroup_online()
925 unsigned long mem_cgroup_get_max(struct mem_cgroup *memcg);
927 unsigned long mem_cgroup_size(struct mem_cgroup *memcg);
929 void mem_cgroup_print_oom_context(struct mem_cgroup *memcg,
932 void mem_cgroup_print_oom_meminfo(struct mem_cgroup *memcg);
954 void mem_cgroup_print_oom_group(struct mem_cgroup *memcg);
959 void __mod_memcg_state(struct mem_cgroup *memcg, int idx, int val);
962 static inline bool mem_cgroup_trylock_pages(struct mem_cgroup *memcg) in mem_cgroup_trylock_pages() argument
966 if (mem_cgroup_disabled() || !atomic_read(&memcg->moving_account)) in mem_cgroup_trylock_pages()
979 static inline void mod_memcg_state(struct mem_cgroup *memcg, in mod_memcg_state() argument
985 __mod_memcg_state(memcg, idx, val); in mod_memcg_state()
992 struct mem_cgroup *memcg; in mod_memcg_page_state() local
998 memcg = page_memcg(page); in mod_memcg_page_state()
999 if (memcg) in mod_memcg_page_state()
1000 mod_memcg_state(memcg, idx, val); in mod_memcg_page_state()
1004 unsigned long memcg_page_state(struct mem_cgroup *memcg, int idx);
1069 void __count_memcg_events(struct mem_cgroup *memcg, enum vm_event_item idx,
1072 static inline void count_memcg_events(struct mem_cgroup *memcg, in count_memcg_events() argument
1079 __count_memcg_events(memcg, idx, count); in count_memcg_events()
1086 struct mem_cgroup *memcg = page_memcg(page); in count_memcg_page_event() local
1088 if (memcg) in count_memcg_page_event()
1089 count_memcg_events(memcg, idx, 1); in count_memcg_page_event()
1095 struct mem_cgroup *memcg = folio_memcg(folio); in count_memcg_folio_events() local
1097 if (memcg) in count_memcg_folio_events()
1098 count_memcg_events(memcg, idx, nr); in count_memcg_folio_events()
1104 struct mem_cgroup *memcg; in count_memcg_event_mm() local
1110 memcg = mem_cgroup_from_task(rcu_dereference(mm->owner)); in count_memcg_event_mm()
1111 if (likely(memcg)) in count_memcg_event_mm()
1112 count_memcg_events(memcg, idx, 1); in count_memcg_event_mm()
1116 static inline void memcg_memory_event(struct mem_cgroup *memcg, in memcg_memory_event() argument
1122 atomic_long_inc(&memcg->memory_events_local[event]); in memcg_memory_event()
1124 cgroup_file_notify(&memcg->events_local_file); in memcg_memory_event()
1127 atomic_long_inc(&memcg->memory_events[event]); in memcg_memory_event()
1129 cgroup_file_notify(&memcg->swap_events_file); in memcg_memory_event()
1131 cgroup_file_notify(&memcg->events_file); in memcg_memory_event()
1137 } while ((memcg = parent_mem_cgroup(memcg)) && in memcg_memory_event()
1138 !mem_cgroup_is_root(memcg)); in memcg_memory_event()
1144 struct mem_cgroup *memcg; in memcg_memory_event_mm() local
1150 memcg = mem_cgroup_from_task(rcu_dereference(mm->owner)); in memcg_memory_event_mm()
1151 if (likely(memcg)) in memcg_memory_event_mm()
1152 memcg_memory_event(memcg, event); in memcg_memory_event_mm()
1202 static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg) in mem_cgroup_is_root() argument
1212 static inline void memcg_memory_event(struct mem_cgroup *memcg, in memcg_memory_event() argument
1223 struct mem_cgroup *memcg, in mem_cgroup_protection() argument
1231 struct mem_cgroup *memcg) in mem_cgroup_calculate_protection() argument
1236 struct mem_cgroup *memcg) in mem_cgroup_unprotected() argument
1241 struct mem_cgroup *memcg) in mem_cgroup_below_low() argument
1247 struct mem_cgroup *memcg) in mem_cgroup_below_min() argument
1280 static inline struct lruvec *mem_cgroup_lruvec(struct mem_cgroup *memcg, in mem_cgroup_lruvec() argument
1297 static inline struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg) in parent_mem_cgroup() argument
1303 struct mem_cgroup *memcg) in mm_match_cgroup() argument
1323 static inline bool mem_cgroup_tryget(struct mem_cgroup *memcg) in mem_cgroup_tryget() argument
1328 static inline void mem_cgroup_put(struct mem_cgroup *memcg) in mem_cgroup_put() argument
1370 static inline void mem_cgroup_scan_tasks(struct mem_cgroup *memcg, in mem_cgroup_scan_tasks() argument
1375 static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg) in mem_cgroup_id() argument
1388 static inline unsigned long mem_cgroup_ino(struct mem_cgroup *memcg) in mem_cgroup_ino() argument
1409 static inline bool mem_cgroup_online(struct mem_cgroup *memcg) in mem_cgroup_online() argument
1421 static inline unsigned long mem_cgroup_get_max(struct mem_cgroup *memcg) in mem_cgroup_get_max() argument
1426 static inline unsigned long mem_cgroup_size(struct mem_cgroup *memcg) in mem_cgroup_size() argument
1432 mem_cgroup_print_oom_context(struct mem_cgroup *memcg, struct task_struct *p) in mem_cgroup_print_oom_context() argument
1437 mem_cgroup_print_oom_meminfo(struct mem_cgroup *memcg) in mem_cgroup_print_oom_meminfo() argument
1449 static inline bool mem_cgroup_trylock_pages(struct mem_cgroup *memcg) in mem_cgroup_trylock_pages() argument
1489 static inline void mem_cgroup_print_oom_group(struct mem_cgroup *memcg) in mem_cgroup_print_oom_group() argument
1493 static inline void __mod_memcg_state(struct mem_cgroup *memcg, in __mod_memcg_state() argument
1499 static inline void mod_memcg_state(struct mem_cgroup *memcg, in mod_memcg_state() argument
1510 static inline unsigned long memcg_page_state(struct mem_cgroup *memcg, int idx) in memcg_page_state() argument
1556 static inline void count_memcg_events(struct mem_cgroup *memcg, in count_memcg_events() argument
1562 static inline void __count_memcg_events(struct mem_cgroup *memcg, in __count_memcg_events() argument
1608 struct mem_cgroup *memcg; in parent_lruvec() local
1610 memcg = lruvec_memcg(lruvec); in parent_lruvec()
1611 if (!memcg) in parent_lruvec()
1613 memcg = parent_mem_cgroup(memcg); in parent_lruvec()
1614 if (!memcg) in parent_lruvec()
1616 return mem_cgroup_lruvec(memcg, lruvec_pgdat(lruvec)); in parent_lruvec()
1684 struct mem_cgroup *memcg; in mem_cgroup_track_foreign_dirty() local
1689 memcg = folio_memcg(folio); in mem_cgroup_track_foreign_dirty()
1690 if (unlikely(memcg && &memcg->css != wb->memcg_css)) in mem_cgroup_track_foreign_dirty()
1723 bool mem_cgroup_charge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages,
1725 void mem_cgroup_uncharge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages);
1731 static inline bool mem_cgroup_under_socket_pressure(struct mem_cgroup *memcg) in mem_cgroup_under_socket_pressure() argument
1734 return !!memcg->tcpmem_pressure; in mem_cgroup_under_socket_pressure()
1736 if (time_before(jiffies, READ_ONCE(memcg->socket_pressure))) in mem_cgroup_under_socket_pressure()
1738 } while ((memcg = parent_mem_cgroup(memcg))); in mem_cgroup_under_socket_pressure()
1742 int alloc_shrinker_info(struct mem_cgroup *memcg);
1743 void free_shrinker_info(struct mem_cgroup *memcg);
1744 void set_shrinker_bit(struct mem_cgroup *memcg, int nid, int shrinker_id);
1745 void reparent_shrinker_deferred(struct mem_cgroup *memcg);
1750 static inline bool mem_cgroup_under_socket_pressure(struct mem_cgroup *memcg) in mem_cgroup_under_socket_pressure() argument
1755 static inline void set_shrinker_bit(struct mem_cgroup *memcg, in set_shrinker_bit() argument
1803 static inline int memcg_kmem_id(struct mem_cgroup *memcg) in memcg_kmem_id() argument
1805 return memcg ? memcg->kmemcg_id : -1; in memcg_kmem_id()
1814 struct mem_cgroup *memcg; in count_objcg_event() local
1820 memcg = obj_cgroup_memcg(objcg); in count_objcg_event()
1821 count_memcg_events(memcg, idx, 1); in count_objcg_event()
1866 static inline int memcg_kmem_id(struct mem_cgroup *memcg) in memcg_kmem_id() argument