From 6929d59ae0314653a70193d22cad68cb911ed84a Mon Sep 17 00:00:00 2001 From: Carsten Emde 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: [] ? printk+0x14/0x17 [] debug_smp_processor_id+0xa6/0xbc [] mem_cgroup_update_mapped_file_stat+0x3c/0x68 [] page_add_file_rmap+0x2e/0x31 [] __do_fault+0x2be/0x3c3 [] handle_mm_fault+0x38c/0x874 [] ? ftrace_now+0x36/0x42 [] do_page_fault+0x2b2/0x2c8 [] ? do_page_fault+0x0/0x2c8 [] error_code+0x6b/0x70 [] ? 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 Signed-off-by: Thomas Gleixner Signed-off-by: Paul Gortmaker --- mm/memcontrol.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 8a79a6f..ddcedda 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1363,8 +1363,10 @@ 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(); if (val > 0) { __this_cpu_inc(mem->stat->count[MEM_CGROUP_STAT_FILE_MAPPED]); SetPageCgroupFileMapped(pc); @@ -1372,6 +1374,7 @@ void mem_cgroup_update_file_mapped(struct page *page, int val) __this_cpu_dec(mem->stat->count[MEM_CGROUP_STAT_FILE_MAPPED]); ClearPageCgroupFileMapped(pc); } + preempt_enable(); done: unlock_page_cgroup(pc); -- 1.7.0.4