diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 7b318bd501df05f26d1b9cb5cdc7e2a635fa5a8f..3a95e8709ac8eb6bb6ac64f4cc669cc53ab3b5df 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -796,8 +796,11 @@ static inline void count_memcg_event_mm(struct mm_struct *mm, static inline void memcg_memory_event(struct mem_cgroup *memcg, enum memcg_memory_event event) { - atomic_long_inc(&memcg->memory_events[event]); - cgroup_file_notify(&memcg->events_file); + do { + atomic_long_inc(&memcg->memory_events[event]); + cgroup_file_notify(&memcg->events_file); + } while ((memcg = parent_mem_cgroup(memcg)) && + !mem_cgroup_is_root(memcg)); } static inline void memcg_memory_event_mm(struct mm_struct *mm,