From: Matt Fleming Date: Sun, 26 Jan 2020 21:19:45 +0000 Subject: [PATCH 317/351] mm/memcontrol: Move misplaced local_unlock_irqrestore() Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=0e93c1cdf2659fdb41c0c23a64d4560bf76bc4b3 [ Upstream commit 071a1d6a6e14d0dec240a8c67b425140d7f92f6a ] The comment about local_lock_irqsave() mentions just the counters and css_put_many()'s callback just invokes a worker so it is safe to move the unlock function after memcg_check_events() so css_put_many() can be invoked without the lock acquired. Cc: Daniel Wagner Signed-off-by: Matt Fleming Signed-off-by: Steven Rostedt (VMware) [bigeasy: rewrote the patch description] Signed-off-by: Sebastian Andrzej Siewior --- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 239fec6eac9f..d5bda1449fe3 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -6541,10 +6541,10 @@ void mem_cgroup_swapout(struct page *page, swp_entry_t entry) mem_cgroup_charge_statistics(memcg, page, PageTransHuge(page), -nr_entries); memcg_check_events(memcg, page); + local_unlock_irqrestore(event_lock, flags); if (!mem_cgroup_is_root(memcg)) css_put_many(&memcg->css, nr_entries); - local_unlock_irqrestore(event_lock, flags); } /**