All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] mm: change irqs_disabled() test to spin_is_locked() in mem_cgroup_swapout
@ 2015-05-29 15:48 ` Clark Williams
  0 siblings, 0 replies; 23+ messages in thread
From: Clark Williams @ 2015-05-29 15:48 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Thomas Gleixner, linux-mm, Andrew Morton, RT,
	Fernando Lopez-Lezcano, Steven Rostedt, Sebastian Andrzej Siewior

Johannes,

We are seeing a panic in the latest RT kernel (4.0.4-rt1) where a
VM_BUG_ON(!irqs_disabled()) in mm/memcontrol.c fires. This is because on
an RT kernel, rt_mutexes (which replace spinlocks) don't disable
interrupts while the lock is held. I talked to Steven and he suggested
that we replace the irqs_disabled() with spin_is_held(). 

Does this patch work for you?

Clark

From: Clark Williams <williams@redhat.com>
Date: Fri, 29 May 2015 10:28:55 -0500
Subject: [PATCH] mm: change irqs_disabled() to spin_is_locked() in mem_cgroup_swapout()

The irqs_disabled() check in mem_cgroup_swapout() fails on the latest
RT kernel because RT mutexes do not disable interrupts when held. Change
the test for the lock being held to use spin_is_locked.

Reported-by: Fernando Lopez-Lezcano <nando@ccrma.Stanford.EDU>
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Clark Williams <williams@redhat.com>
---
 mm/memcontrol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 9da0f3e9c1f3..70befa14a8ce 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5845,7 +5845,7 @@ void mem_cgroup_swapout(struct page *page,
swp_entry_t entry) page_counter_uncharge(&memcg->memory, 1);
 
 	/* XXX: caller holds IRQ-safe mapping->tree_lock */
-	VM_BUG_ON(!irqs_disabled());
+	VM_BUG_ON(!spin_is_locked(&page_mapping(page)->tree_lock));
 
 	mem_cgroup_charge_statistics(memcg, page, -1);
 	memcg_check_events(memcg, page);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2015-07-09 16:43 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-29 15:48 [RFC] mm: change irqs_disabled() test to spin_is_locked() in mem_cgroup_swapout Clark Williams
2015-05-29 15:48 ` Clark Williams
2015-05-29 19:11 ` Johannes Weiner
2015-05-29 19:11   ` Johannes Weiner
2015-05-29 19:21   ` Steven Rostedt
2015-05-29 21:26 ` Andrew Morton
2015-05-29 21:26   ` Andrew Morton
2015-06-01 18:14   ` [RFC][PATCH] mm: ifdef out VM_BUG_ON check on PREEMPT_RT_FULL Clark Williams
2015-06-01 18:14     ` Clark Williams
2015-06-01 19:00     ` Johannes Weiner
2015-06-01 19:28       ` Steven Rostedt
2015-06-01 19:28         ` Steven Rostedt
2015-06-11 11:40       ` Sebastian Andrzej Siewior
2015-06-11 11:40         ` Sebastian Andrzej Siewior
2015-06-19 18:00         ` Johannes Weiner
2015-06-19 18:00           ` Johannes Weiner
2015-07-08 15:44           ` Sebastian Andrzej Siewior
2015-07-09 15:07             ` Thomas Gleixner
2015-07-09 15:07               ` Thomas Gleixner
2015-07-09 16:00               ` Johannes Weiner
2015-07-09 16:00                 ` Johannes Weiner
2015-07-09 16:43                 ` Thomas Gleixner
2015-07-09 16:43                   ` Thomas Gleixner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.