From patchwork Mon Jul 6 19:47:39 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 29510 Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 10EC3B6F1F for ; Tue, 7 Jul 2009 05:43:29 +1000 (EST) Received: by ozlabs.org (Postfix) id 04DEDDDD0C; Tue, 7 Jul 2009 05:43:29 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 8AC3EDDD0B for ; Tue, 7 Jul 2009 05:43:28 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753094AbZGFTnW (ORCPT ); Mon, 6 Jul 2009 15:43:22 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753355AbZGFTnW (ORCPT ); Mon, 6 Jul 2009 15:43:22 -0400 Received: from mx2.redhat.com ([66.187.237.31]:47325 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753017AbZGFTnV (ORCPT ); Mon, 6 Jul 2009 15:43:21 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n66JhPga007341; Mon, 6 Jul 2009 15:43:25 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n66JhOZn024292; Mon, 6 Jul 2009 15:43:24 -0400 Received: from dhcp231-156.rdu.redhat.com (dhcp231-156.rdu.redhat.com [10.11.231.156]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n66JhOhG026431; Mon, 6 Jul 2009 15:43:24 -0400 Date: Mon, 6 Jul 2009 15:47:39 -0400 From: Josef Bacik To: linux-ext4@vger.kernel.org Cc: emcnabb@redhat.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH] fix softlockups in ext2/3 when trying to allocate blocks Message-ID: <20090706194739.GB19798@dhcp231-156.rdu.redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org This isn't a huge deal, but using a big beefy box with more CPUs than what is sane, you can get a nice flood of softlockup messages when running heavy multi-threaded io tests on ext2/3. The processors compete for blocks from the allocator, so they will loop quite a bit trying to get their allocation. This patch simply makes sure that we reschedule if need be. This made the softlockup messages disappear whereas before they happened almost immediately. Thanks, Tested-by: Evan McNabb Signed-off-by: Josef Bacik --- fs/ext2/balloc.c | 1 + fs/ext3/balloc.c | 2 ++ 2 files changed, 3 insertions(+), 0 deletions(-) diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c index 7f8d2e5..17dd55f 100644 --- a/fs/ext2/balloc.c +++ b/fs/ext2/balloc.c @@ -1176,6 +1176,7 @@ ext2_try_to_allocate_with_rsv(struct super_block *sb, unsigned int group, break; /* succeed */ } num = *count; + cond_resched(); } return ret; } diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index 27967f9..cffc8cd 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c @@ -735,6 +735,7 @@ bitmap_search_next_usable_block(ext3_grpblk_t start, struct buffer_head *bh, struct journal_head *jh = bh2jh(bh); while (start < maxblocks) { + cond_resched(); next = ext3_find_next_zero_bit(bh->b_data, maxblocks, start); if (next >= maxblocks) return -1; @@ -1391,6 +1392,7 @@ ext3_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle, break; /* succeed */ } num = *count; + cond_resched(); } out: if (ret >= 0) {