mm: memcontrol: fix missing wakeup polling thread
When we poll the swap.events, we can miss being woken up when the swap
event occurs. Because we didn't notify.
Fixes: f3a53a3a1e
("mm, memcontrol: implement memory.swap.events")
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Roman Gushchin <guro@fb.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Yafang Shao <laoar.shao@gmail.com>
Cc: Chris Down <chris@chrisdown.name>
Cc: Tejun Heo <tj@kernel.org>
Link: https://lkml.kernel.org/r/20201105161936.98312-1-songmuchun@bytedance.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
e7e046155a
commit
8b21ca0218
@@ -900,11 +900,18 @@ static inline void count_memcg_event_mm(struct mm_struct *mm,
|
|||||||
static inline void memcg_memory_event(struct mem_cgroup *memcg,
|
static inline void memcg_memory_event(struct mem_cgroup *memcg,
|
||||||
enum memcg_memory_event event)
|
enum memcg_memory_event event)
|
||||||
{
|
{
|
||||||
|
bool swap_event = event == MEMCG_SWAP_HIGH || event == MEMCG_SWAP_MAX ||
|
||||||
|
event == MEMCG_SWAP_FAIL;
|
||||||
|
|
||||||
atomic_long_inc(&memcg->memory_events_local[event]);
|
atomic_long_inc(&memcg->memory_events_local[event]);
|
||||||
|
if (!swap_event)
|
||||||
cgroup_file_notify(&memcg->events_local_file);
|
cgroup_file_notify(&memcg->events_local_file);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
atomic_long_inc(&memcg->memory_events[event]);
|
atomic_long_inc(&memcg->memory_events[event]);
|
||||||
|
if (swap_event)
|
||||||
|
cgroup_file_notify(&memcg->swap_events_file);
|
||||||
|
else
|
||||||
cgroup_file_notify(&memcg->events_file);
|
cgroup_file_notify(&memcg->events_file);
|
||||||
|
|
||||||
if (!cgroup_subsys_on_dfl(memory_cgrp_subsys))
|
if (!cgroup_subsys_on_dfl(memory_cgrp_subsys))
|
||||||
|
Reference in New Issue
Block a user