linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* BUG: using smp_processor_id() in preemptible
@ 2008-12-08 12:13 Tim Blechmann
  2009-01-13  9:44 ` Tim Blechmann
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Blechmann @ 2008-12-08 12:13 UTC (permalink / raw)
  To: linux-rt-users

hi all,

using the 2.6.26.6-rt11 patchset on a 2.6.26.8 kernel, i get the 
following stack traces:

[ 4262.931832] BUG: using smp_processor_id() in preemptible [00000000] code: bash/361
[ 4262.931846] caller is mem_cgroup_charge_statistics+0x6d/0xa0
[ 4262.931852] Pid: 361, comm: bash Not tainted 2.6.26.8-rt11 #3
[ 4262.931855] 
[ 4262.931856] Call Trace:
[ 4262.931886]  [<ffffffff80396e8c>] debug_smp_processor_id+0xcc/0xd0
[ 4262.931895]  [<ffffffff802daead>] mem_cgroup_charge_statistics+0x6d/0xa0
[ 4262.931905]  [<ffffffff802daf19>] __mem_cgroup_add_list+0x39/0x60
[ 4262.931911]  [<ffffffff802db744>] mem_cgroup_charge_common+0x314/0x330
[ 4262.931925]  [<ffffffff802db78e>] mem_cgroup_charge+0xe/0x10
[ 4262.931933]  [<ffffffff802b8773>] do_wp_page+0x133/0x5a0
[ 4262.931944]  [<ffffffff804d7461>] ? __rt_spin_lock+0x81/0x90
[ 4262.931956]  [<ffffffff802ba805>] handle_mm_fault+0x605/0x900
[ 4262.931975]  [<ffffffff804dacfc>] do_page_fault+0x45c/0xd50
[ 4262.931998]  [<ffffffff8021d6ee>] ? native_smp_send_reschedule+0x2e/0x50
[ 4262.932006]  [<ffffffff8023a041>] ? __resched_task+0x91/0x120
[ 4262.932015]  [<ffffffff8023b5f4>] ? task_new_fair+0xb4/0x100
[ 4262.932027]  [<ffffffff8023e09b>] ? wake_up_new_task+0xdb/0x190
[ 4262.932038]  [<ffffffff80241190>] ? do_fork+0xf0/0x330
[ 4262.932048]  [<ffffffff804d748e>] ? rt_spin_lock+0x1e/0x50
[ 4262.932056]  [<ffffffff802dbad2>] ? fd_install+0x52/0x60
[ 4262.932072]  [<ffffffff804d81c9>] error_exit+0x0/0x60

hth, tim

-- 
tim@klingt.org
http://tim.klingt.org

There's no such entity as "most people". These are generalities. All
generalities are meaningless. You've got to pin it down to a specific
person doing a specific thing at a specific time and space.
  William S. Burroughs


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

* Re: BUG: using smp_processor_id() in preemptible
  2008-12-08 12:13 BUG: using smp_processor_id() in preemptible Tim Blechmann
@ 2009-01-13  9:44 ` Tim Blechmann
  2009-02-20 20:42   ` Paul Gortmaker
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Blechmann @ 2009-01-13  9:44 UTC (permalink / raw)
  To: linux-rt-users

fyi, this is still an issue in 2.6.26.8-rt13.

tim

On Mon, 08 Dec 2008 12:13:31 +0000, Tim Blechmann wrote:

> hi all,
> 
> using the 2.6.26.6-rt11 patchset on a 2.6.26.8 kernel, i get the
> following stack traces:
> 
> [ 4262.931832] BUG: using smp_processor_id() in preemptible [00000000]
> code: bash/361 [ 4262.931846] caller is
> mem_cgroup_charge_statistics+0x6d/0xa0 [ 4262.931852] Pid: 361, comm:
> bash Not tainted 2.6.26.8-rt11 #3 [ 4262.931855]
> [ 4262.931856] Call Trace:
> [ 4262.931886]  [<ffffffff80396e8c>] debug_smp_processor_id+0xcc/0xd0 [
> 4262.931895]  [<ffffffff802daead>]
> mem_cgroup_charge_statistics+0x6d/0xa0 [ 4262.931905] 
> [<ffffffff802daf19>] __mem_cgroup_add_list+0x39/0x60 [ 4262.931911] 
> [<ffffffff802db744>] mem_cgroup_charge_common+0x314/0x330 [ 4262.931925]
>  [<ffffffff802db78e>] mem_cgroup_charge+0xe/0x10 [ 4262.931933] 
> [<ffffffff802b8773>] do_wp_page+0x133/0x5a0 [ 4262.931944] 
> [<ffffffff804d7461>] ? __rt_spin_lock+0x81/0x90 [ 4262.931956] 
> [<ffffffff802ba805>] handle_mm_fault+0x605/0x900 [ 4262.931975] 
> [<ffffffff804dacfc>] do_page_fault+0x45c/0xd50 [ 4262.931998] 
> [<ffffffff8021d6ee>] ? native_smp_send_reschedule+0x2e/0x50 [
> 4262.932006]  [<ffffffff8023a041>] ? __resched_task+0x91/0x120 [
> 4262.932015]  [<ffffffff8023b5f4>] ? task_new_fair+0xb4/0x100 [
> 4262.932027]  [<ffffffff8023e09b>] ? wake_up_new_task+0xdb/0x190 [
> 4262.932038]  [<ffffffff80241190>] ? do_fork+0xf0/0x330 [ 4262.932048] 
> [<ffffffff804d748e>] ? rt_spin_lock+0x1e/0x50 [ 4262.932056] 
> [<ffffffff802dbad2>] ? fd_install+0x52/0x60 [ 4262.932072] 
> [<ffffffff804d81c9>] error_exit+0x0/0x60

-- 
tim@klingt.org
http://tim.klingt.org

Lesser artists borrow, great artists steal.
  Igor Stravinsky


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

* Re: BUG: using smp_processor_id() in preemptible
  2009-01-13  9:44 ` Tim Blechmann
@ 2009-02-20 20:42   ` Paul Gortmaker
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Gortmaker @ 2009-02-20 20:42 UTC (permalink / raw)
  To: Tim Blechmann; +Cc: linux-rt-users, Steven Rostedt

[-- Attachment #1: Type: text/plain, Size: 817 bytes --]

On Tue, Jan 13, 2009 at 4:44 AM, Tim Blechmann <tim@klingt.org> wrote:
> fyi, this is still an issue in 2.6.26.8-rt13.
>
> tim

The attached patch should fix it ; it is based on the discussion
that took place here on rt-users.

Paul.

>
>  Tim Blechmann wrote:
>
>> hi all,
>>
>> using the 2.6.26.6-rt11 patchset on a 2.6.26.8 kernel, i get the
>> following stack traces:
>>
>> [ 4262.931832] BUG: using smp_processor_id() in preemptible [00000000]
>> code: bash/361 [ 4262.931846] caller is
>> mem_cgroup_charge_statistics+0x6d/0xa0 [ 4262.931852] Pid: 361, comm:
>> bash Not tainted 2.6.26.8-rt11 #3 [ 4262.931855]
>> [ 4262.931856] Call Trace:
>> [ 4262.931886]  [<ffffffff80396e8c>] debug_smp_processor_id+0xcc/0xd0 [
>> 4262.931895]  [<ffffffff802daead>]
>> mem_cgroup_charge_statistics+0x6d/0xa0 [ 4262.931905]

[-- Attachment #2: 0001-memcg-fix-BUG-using-smp_processor_id.patch --]
[-- Type: text/x-patch, Size: 2987 bytes --]

From faa0ea31405ec9d44e8242e224f8e607642f3c5e Mon Sep 17 00:00:00 2001
From: Paul Gortmaker <paul.gortmaker@windriver.com>
Date: Mon, 26 Jan 2009 21:15:22 -0500
Subject: [PATCH] memcg: fix BUG: using smp_processor_id() in preemptible

A combination of upstream (e.g. addb9efe) and as per discussion
on rt list (Dec 2008) between Tim Blechmann and Kamezawa Hiroyuki,
this is needed to fix the following:

BUG: using smp_processor_id() in preemptible [00000000] code: swapper/1
caller is mem_cgroup_charge_statistics+0x85/0xa0
Pid: 1, comm: swapper Not tainted 2.6.26.8-rt12 #1

Call Trace:
 [<ffffffff8038eb94>] debug_smp_processor_id+0xc4/0xd0
 [<ffffffff8029ffe5>] mem_cgroup_charge_statistics+0x85/0xa0
 [<ffffffff802a0039>] __mem_cgroup_add_list+0x39/0x60
 [<ffffffff802a0807>] mem_cgroup_charge_common+0x317/0x340
 [<ffffffff802a0849>] mem_cgroup_cache_charge+0x19/0x20
 [<ffffffff80276918>] add_to_page_cache+0x38/0x250
 [<ffffffff8027d43d>] ? __alloc_pages_internal+0xed/0x4f0
 [<ffffffff80276b49>] add_to_page_cache_lru+0x19/0x40
 [<ffffffff80277603>] find_or_create_page+0x63/0xb0
 [<ffffffff802cd401>] __getblk+0x101/0x320
 [<ffffffff802fddd6>] __ext3_get_inode_loc+0x106/0x320
 [<ffffffff802fe060>] ext3_iget+0x70/0x420
 [<ffffffff80305068>] ext3_lookup+0xa8/0x100

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 mm/memcontrol.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index ed1cfb1..86e7f14 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -65,11 +65,11 @@ struct mem_cgroup_stat {
 /*
  * For accounting under irq disable, no need for increment preempt count.
  */
-static void __mem_cgroup_stat_add_safe(struct mem_cgroup_stat *stat,
+static inline void __mem_cgroup_stat_add_safe(struct mem_cgroup_stat_cpu *stat,
 		enum mem_cgroup_stat_index idx, int val)
 {
-	int cpu = smp_processor_id();
-	stat->cpustat[cpu].count[idx] += val;
+	stat->count[idx] += val;
+
 }
 
 static s64 mem_cgroup_read_stat(struct mem_cgroup_stat *stat,
@@ -195,19 +195,24 @@ static void mem_cgroup_charge_statistics(struct mem_cgroup *mem, int flags,
 {
 	int val = (charge)? 1 : -1;
 	struct mem_cgroup_stat *stat = &mem->stat;
+	struct mem_cgroup_stat_cpu *cpustat;
+	int cpu = get_cpu();
 
 	VM_BUG_ON(!irqs_disabled());
+
+	cpustat = &stat->cpustat[cpu];
 	if (flags & PAGE_CGROUP_FLAG_CACHE)
-		__mem_cgroup_stat_add_safe(stat, MEM_CGROUP_STAT_CACHE, val);
+		__mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_CACHE, val);
 	else
-		__mem_cgroup_stat_add_safe(stat, MEM_CGROUP_STAT_RSS, val);
+		__mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_RSS, val);
 
 	if (charge)
-		__mem_cgroup_stat_add_safe(stat,
+		__mem_cgroup_stat_add_safe(cpustat,
 				MEM_CGROUP_STAT_PGPGIN_COUNT, 1);
 	else
-		__mem_cgroup_stat_add_safe(stat,
+		__mem_cgroup_stat_add_safe(cpustat,
 				MEM_CGROUP_STAT_PGPGOUT_COUNT, 1);
+	put_cpu();
 }
 
 static struct mem_cgroup_per_zone *
-- 
1.6.0.4


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

end of thread, other threads:[~2009-02-20 20:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-08 12:13 BUG: using smp_processor_id() in preemptible Tim Blechmann
2009-01-13  9:44 ` Tim Blechmann
2009-02-20 20:42   ` Paul Gortmaker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).