linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: Anton Blanchard <anton@samba.org>
Cc: aarcange@redhat.com, mel@csn.ul.ie, akpm@linux-foundation.org,
	hughd@google.com, lkml <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH] Re: kswapd stuck using 100% CPU
Date: Sat, 24 Mar 2012 10:26:21 -0400	[thread overview]
Message-ID: <20120324102621.353114da@annuminas.surriel.com> (raw)
In-Reply-To: <20120324130353.48f2e4c8@kryten>

On Sat, 24 Mar 2012 13:03:53 +1100
Anton Blanchard <anton@samba.org> wrote:

> I booted the latest git today on a ppc64 box. When I pushed it into
> swap I noticed both kswapd's were using 100% CPU and the soft lockup
> detector suggested it was stuck in balance_pgdat:
> 
> BUG: soft lockup - CPU#7 stuck for 23s! [kswapd1:359]
> Call Trace:
> [c00000000015e190] .balance_pgdat+0x150/0x940 
> [c00000000015eb2c] .kswapd+0x1ac/0x490
> [c00000000009edbc] .kthread+0xbc/0xd0
> [c00000000002142c] .kernel_thread+0x54/0x70

Are you running without CONFIG_COMPACTION enabled by any chance?

Because if you do, the stub function compaction_suitable will always
return COMPACT_SKIPPED:
 
> I haven't had time to bisect but I did notice we were looping here:
> 
> +++ b/mm/vmscan.c
> @@ -2945,9 +2959,11 @@ out:
>  			if (zone->all_unreclaimable && priority != DEF_PRIORITY)
>  				continue;
>  
> +#if 0
>  			/* Would compaction fail due to lack of free memory? */
>  			if (compaction_suitable(zone, order) == COMPACT_SKIPPED)
>  				goto loop_again;
> +#endif

The patch below should fix it.

-----

Only test compaction_suitable if the kernel is built with CONFIG_COMPACTION,
otherwise the stub compaction_suitable function will always return
COMPACT_SKIPPED and send kswapd into an infinite loop.

Signed-off-by: Rik van Riel <riel@redhat.com>
Reported-by: Anton Blanchard <anton@samba.org>

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 7658fd6..33c332b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2946,7 +2946,8 @@ out:
 				continue;
 
 			/* Would compaction fail due to lack of free memory? */
-			if (compaction_suitable(zone, order) == COMPACT_SKIPPED)
+			if (COMPACTION_BUILD &&
+			    compaction_suitable(zone, order) == COMPACT_SKIPPED)
 				goto loop_again;
 
 			/* Confirm the zone is balanced for order-0 */

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2012-03-24 14:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-24  2:03 kswapd stuck using 100% CPU Anton Blanchard
2012-03-24 14:26 ` Rik van Riel [this message]
2012-03-25 19:16   ` [PATCH] " Hugh Dickins
2012-03-26  9:32   ` Mel Gorman
2012-03-26 10:40     ` Pekka Enberg
2012-03-26 13:56       ` Mel Gorman
2012-03-26 15:10         ` Pekka Enberg

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=20120324102621.353114da@annuminas.surriel.com \
    --to=riel@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=anton@samba.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=torvalds@linux-foundation.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).