UPSTREAM: mm: memcg: make sure memory.events is uptodate when waking pollers
Commit a983b5ebee57 ("mm: memcontrol: fix excessive complexity in
memory.stat reporting") added per-cpu drift to all memory cgroup stats
and events shown in memory.stat and memory.events.
For memory.stat this is acceptable. But memory.events issues file
notifications, and somebody polling the file for changes will be
confused when the counters in it are unchanged after a wakeup.
Luckily, the events in memory.events - MEMCG_LOW, MEMCG_HIGH, MEMCG_MAX,
MEMCG_OOM - are sufficiently rare and high-level that we don't need
per-cpu buffering for them: MEMCG_HIGH and MEMCG_MAX would be the most
frequent, but they're counting invocations of reclaim, which is a
complex operation that touches many shared cachelines.
This splits memory.events from the generic VM events and tracks them in
their own, unbuffered atomic counters. That's also cleaner, as it
eliminates the ugly enum nesting of VM and cgroup events.
[firstname.lastname@example.org: "array subscript is above array bounds"]
Fixes: a983b5ebee57 ("mm: memcontrol: fix excessive complexity in memory.stat reporting")
Signed-off-by: Johannes Weiner <email@example.com>
Reported-by: Tejun Heo <firstname.lastname@example.org>
Acked-by: Tejun Heo <email@example.com>
Acked-by: Michal Hocko <firstname.lastname@example.org>
Cc: Vladimir Davydov <email@example.com>
Cc: Roman Gushchin <firstname.lastname@example.org>
Cc: Rik van Riel <email@example.com>
Cc: Stephen Rothwell <firstname.lastname@example.org>
Signed-off-by: Andrew Morton <email@example.com>
Signed-off-by: Linus Torvalds <firstname.lastname@example.org>
(cherry picked from commit e27be240df53f1a20c659168e722b5d9f16cc7f4)
Signed-off-by: vaibhavrustagi <email@example.com>
TEST=tryjob and validation test. Tested with the repro steps for creating zombies.
(cherry picked from commit 685af806625a877a1b8400a14561811e822be183)
Reviewed-by: Guenter Roeck <firstname.lastname@example.org>
Reviewed-by: Sean Paul <email@example.com>
Reviewed-by: Greg Thelen <firstname.lastname@example.org>
Commit-Queue: Vaibhav Rustagi <email@example.com>
Tested-by: Vaibhav Rustagi <firstname.lastname@example.org>
3 files changed