[RT,4/8] mm/memcontrol: Move misplaced local_unlock_irqrestore()
diff mbox series

Message ID 41b2fe158cc09157964879dce19e74e1de962f27.1583783251.git.zanussi@kernel.org
State New
Headers show
Series
  • Linux v4.14.172-rt78-rc1
Related show

Commit Message

Tom Zanussi March 9, 2020, 7:47 p.m. UTC
From: Matt Fleming <matt@codeblueprint.co.uk>

v4.14.172-rt78-rc1 stable review patch.
If anyone has any objections, please let me know.

-----------


[ 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 <wagi@monom.org>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
[bigeasy: rewrote the patch description]
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Tom Zanussi <zanussi@kernel.org>
---
 mm/memcontrol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 0503b31e2a873..a359a24ebd9f0 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6102,10 +6102,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);
 }
 
 /**