blob: dce24573b568458ff9bf293e5304294ad021ccf5 [file] [log] [blame]
From 3d235e3c6b3f0069e3d7ca9b458bd63db070bb7f Mon Sep 17 00:00:00 2001
From: Carsten Emde <c.emde@osadl.org>
Date: Tue, 21 Jul 2009 18:58:20 +0200
Subject: [PATCH] mm: memcontrol preemption fix
commit e580f50631b1d82949f8a1c72f0e953cef2df07c in tip.
Cures the following On RT:
BUG: using smp_processor_id() in preemptible [00000000] code: init/1
caller is mem_cgroup_update_mapped_file_stat+0x3c/0x68
Pid: 1, comm: init Not tainted 2.6.31-rc3-rt1 #1
Call Trace:
[<c0759ec5>] ? printk+0x14/0x17
[<c059c932>] debug_smp_processor_id+0xa6/0xbc
[<c04c137a>] mem_cgroup_update_mapped_file_stat+0x3c/0x68
[<c04b43cd>] page_add_file_rmap+0x2e/0x31
[<c04ae3aa>] __do_fault+0x2be/0x3c3
[<c04ae83b>] handle_mm_fault+0x38c/0x874
[<c0488643>] ? ftrace_now+0x36/0x42
[<c075e4a6>] do_page_fault+0x2b2/0x2c8
[<c075e1f4>] ? do_page_fault+0x0/0x2c8
[<c075c923>] error_code+0x6b/0x70
[<c075e1f4>] ? do_page_fault+0x0/0x2c8
RT needs to disable preemption explicitely here.
[PG: change get_cpu() -> preempt_disable() due to upstream c62b1a3b31]
Signed-off-by: Carsten Emde <carsten.emde@osadl.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 7973b52..24554f5 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1366,9 +1366,12 @@ void mem_cgroup_update_file_mapped(struct page *page, int val)
goto done;
/*
- * Preemption is already disabled. We can use __this_cpu_xxx
+ * Preemption is already disabled. We can use __this_cpu_xxx,
+ * but that's not true for RT !
*/
+ preempt_disable();
__this_cpu_add(mem->stat->count[MEM_CGROUP_STAT_FILE_MAPPED], val);
+ preempt_enable();
done:
unlock_page_cgroup(pc);
--
1.7.1.1