From patchwork Wed Aug 19 12:17:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 7037191 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D4F29C05AC for ; Wed, 19 Aug 2015 12:18:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 003C9207F9 for ; Wed, 19 Aug 2015 12:18:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2D814207F6 for ; Wed, 19 Aug 2015 12:18:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932173AbbHSMSX (ORCPT ); Wed, 19 Aug 2015 08:18:23 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:37356 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754101AbbHSMSC (ORCPT ); Wed, 19 Aug 2015 08:18:02 -0400 Received: by wibhh20 with SMTP id hh20so6601228wib.0; Wed, 19 Aug 2015 05:18:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+4cwcvB9N6t36oKO1e5o5zQ/aHvRqDn+MS/mn7XbRmg=; b=QdOLjm0hWFplpR8StIWLn3+I14miEoqEpoZb4VM9E2U2hwZZ1ndkmfIDR750drV4F9 Z31P0EuO/B8HelyMt/cC8HuqKVHD4REOF2PGjpY6Vv1YPo5Y9uiTM+nH2ju3Vm94Dw99 llI2Is+ehecXS2rO2zFQXDTzpisqUlJnxeW3ZvK+97UyQxp27TVfjucVtdrn1tChztIH ZVqQzbER63QEZQnlnPjSIv/nyPcKzaa5DMjeE4EewzjWdRBFRl+Yt9fFbySj0NGtInhQ DMbLKGdhwoR59cxSl/a11dKsswE1bi5DMoASZGkpl4i4Ia2HdaxTtoto76cxCQzv288f G1zw== X-Received: by 10.194.85.163 with SMTP id i3mr23257068wjz.75.1439986681601; Wed, 19 Aug 2015 05:18:01 -0700 (PDT) Received: from tiehlicka.suse.cz (bband-dyn181.95-103-48.t-com.sk. [95.103.48.181]) by smtp.gmail.com with ESMTPSA id s7sm25758601wix.23.2015.08.19.05.18.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Aug 2015 05:18:01 -0700 (PDT) From: mhocko@kernel.org To: linux-btrfs@vger.kernel.org Cc: Chris Mason , Josef Bacik , David Sterba , linux-kernel@vger.kernel.org, Michal Hocko Subject: [PATCH 2/2] btrfs: use __GFP_NOFAIL in alloc_btrfs_bio Date: Wed, 19 Aug 2015 14:17:41 +0200 Message-Id: <1439986661-15896-3-git-send-email-mhocko@kernel.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1439986661-15896-1-git-send-email-mhocko@kernel.org> References: <1439986661-15896-1-git-send-email-mhocko@kernel.org> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Michal Hocko alloc_btrfs_bio relies on GFP_NOFS allocation when committing the transaction but this allocation context is rather weak wrt. reclaim capabilities. The page allocator currently tries hard to not fail these allocations if they are small (<=PAGE_ALLOC_COSTLY_ORDER) but it can still fail if the _current_ process is the OOM killer victim. Moreover there is an attempt to move away from the default no-fail behavior and allow these allocation to fail more eagerly. This would lead to: [ 37.928625] kernel BUG at fs/btrfs/extent_io.c:4045 which is clearly undesirable and the nofail behavior should be explicit if the allocation failure cannot be tolerated. Signed-off-by: Michal Hocko --- fs/btrfs/volumes.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 53af23f2c087..42b9949dd71d 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -4914,9 +4914,7 @@ static struct btrfs_bio *alloc_btrfs_bio(int total_stripes, int real_stripes) * and the stripes */ sizeof(u64) * (total_stripes), - GFP_NOFS); - if (!bbio) - return NULL; + GFP_NOFS|__GFP_NOFAIL); atomic_set(&bbio->error, 0); atomic_set(&bbio->refs, 1);