| From bb89e38ca6a2f72d70b4b4c89359a18c8cb31659 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 f4ede99..2c5b6d6 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.1.1 |
| |