linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Joakim Hernberg <jhernberg@alchemy.lu>
Cc: linux-rt-users@vger.kernel.org
Subject: Re: BUG: scheduling while atomic on 4.0.4-rt
Date: Thu, 11 Jun 2015 16:21:35 +0200	[thread overview]
Message-ID: <20150611142135.GJ16115@linutronix.de> (raw)
In-Reply-To: <20150601180529.76806ca5@tor.valhalla.alchemy.lu>

* Joakim Hernberg | 2015-06-01 18:05:29 [+0200]:

>Just got this on 4.0.4-rt1.
>
>[74169.672071] BUG: scheduling while atomic: chromium/1566/0x00000002
>[74169.672134] Call Trace:
>[74169.672146]  [<ffffffff8158c6af>] schedule+0x3f/0xd0
>[74169.672148]  [<ffffffff8158dc1d>] rt_spin_lock_slowlock+0xdd/0x290
>[74169.672151]  [<ffffffff8158f749>] rt_spin_lock+0x29/0x30
>[74169.672154]  [<ffffffff81177bdd>] pagevec_lru_move_fn+0x9d/0x120
>[74169.672156]  [<ffffffff81176fb0>] ? ftrace_raw_output_mm_lru_activate+0x70/0x70
>[74169.672158]  [<ffffffff8117873e>] lru_add_drain_cpu+0x12e/0x170
>[74169.672160]  [<ffffffff81192587>] compact_zone+0x537/0x8e0

This should fix it:

diff --git a/include/linux/swap.h b/include/linux/swap.h
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -298,6 +298,7 @@ extern unsigned long nr_free_pagecache_pages(void);
 
 
 /* linux/mm/swap.c */
+DECLARE_LOCAL_IRQ_LOCK(swapvec_lock);
 extern void lru_cache_add(struct page *);
 extern void lru_cache_add_anon(struct page *page);
 extern void lru_cache_add_file(struct page *page);
diff --git a/mm/compaction.c b/mm/compaction.c
index 8c0d9459b54a..0b670021a977 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1387,10 +1387,12 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
 				cc->migrate_pfn & ~((1UL << cc->order) - 1);
 
 			if (last_migrated_pfn < current_block_start) {
-				cpu = get_cpu();
+				cpu = get_cpu_light();
+				local_lock_irq(swapvec_lock);
 				lru_add_drain_cpu(cpu);
+				local_unlock_irq(swapvec_lock);
 				drain_local_pages(zone);
-				put_cpu();
+				put_cpu_light();
 				/* No more flushing until we migrate again */
 				last_migrated_pfn = 0;
 			}
diff --git a/mm/swap.c b/mm/swap.c
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -46,7 +46,7 @@ static DEFINE_PER_CPU(struct pagevec, lru_rotate_pvecs);
 static DEFINE_PER_CPU(struct pagevec, lru_deactivate_pvecs);
 
 static DEFINE_LOCAL_IRQ_LOCK(rotate_lock);
-static DEFINE_LOCAL_IRQ_LOCK(swapvec_lock);
+DEFINE_LOCAL_IRQ_LOCK(swapvec_lock);
 
 /*
  * This path almost never happens for VM activity - pages are normally

Sebastian

      reply	other threads:[~2015-06-11 14:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 16:05 BUG: scheduling while atomic on 4.0.4-rt Joakim Hernberg
2015-06-11 14:21 ` Sebastian Andrzej Siewior [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150611142135.GJ16115@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=jhernberg@alchemy.lu \
    --cc=linux-rt-users@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).