From patchwork Mon Jan 9 14:39:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 9504949 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8AF1860762 for ; Mon, 9 Jan 2017 14:42:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80EB9284E5 for ; Mon, 9 Jan 2017 14:42:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75B4828508; Mon, 9 Jan 2017 14:42:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18CE2284F8 for ; Mon, 9 Jan 2017 14:42:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942455AbdAIOjk (ORCPT ); Mon, 9 Jan 2017 09:39:40 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35044 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S940010AbdAIOjL (ORCPT ); Mon, 9 Jan 2017 09:39:11 -0500 Received: by mail-wm0-f68.google.com with SMTP id l2so22703328wml.2; Mon, 09 Jan 2017 06:39:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tBeWjpEYExYZdNcyjvo5CWyysiAS1e2UnL12yPSxjnc=; b=lhS4Y4csEAU2kblt6DGfAU5gAlPISJStnld0AD6Jeen/nAsOQNJn5M7Vp/pihHTzMv 1XLrBmsCFsMO/IeyU35kP9Gz0SJfGprpD9kL1h3TFV85M4USw9ycZu89tFQoXO0AiE29 bYhABgCg7cLZnoRqHuUh5r45fx6YkV9JKEv1/220q54s9mUE5LvcdMPAIhZNi9rOgR83 AY1hRKU0E2SuMbwUWfc9zkZn/SDFiY8s8VQ8jnYkFR7/x8qszTCRiTq/MaBHCOjtOyOj 3i1Vzg7cdwNOmCQVxu3aqh6eUNWx/T/4RXiMnN7Ze8jT5/HXMbRYzfkc1DngtOFmTMJN p74A== X-Gm-Message-State: AIkVDXKMVKpnKO0dq8MBrWroWv+Ytp2nh9gAt1laassL+G5qwjtKDjfbsdQLaSUIjIJIfw== X-Received: by 10.223.128.77 with SMTP id 71mr38710wrk.48.1483972748627; Mon, 09 Jan 2017 06:39:08 -0800 (PST) Received: from tiehlicka.suse.cz ([213.151.95.130]) by smtp.gmail.com with ESMTPSA id jm6sm123881830wjb.27.2017.01.09.06.39.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jan 2017 06:39:07 -0800 (PST) From: Michal Hocko To: Chris Mason , David Sterba , Josef Bacik Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Michal Hocko Subject: [PATCH 1/2] etrfs: fix up misleading GFP_NOFS usage in btrfs_releasepage Date: Mon, 9 Jan 2017 15:39:02 +0100 Message-Id: <20170109143903.32280-1-mhocko@kernel.org> X-Mailer: git-send-email 2.11.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Michal Hocko b335b0034e25 ("Btrfs: Avoid using __GFP_HIGHMEM with slab allocator") has reduced the allocation mask in btrfs_releasepage to GFP_NOFS just to prevent from giving an unappropriate gfp mask to the slab allocator deeper down the callchain (in alloc_extent_state). This is wrong for two reasons a) GFP_NOFS might be just too restrictive for the calling context b) it is better to tweak the gfp mask down when it needs that. So just remove the mask tweaking from btrfs_releasepage and move it down to alloc_extent_state where it is needed. Signed-off-by: Michal Hocko --- fs/btrfs/extent_io.c | 5 +++++ fs/btrfs/inode.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index b38150eec6b4..f6ae94a4acad 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -226,6 +226,11 @@ static struct extent_state *alloc_extent_state(gfp_t mask) { struct extent_state *state; + /* + * The given mask might be not appropriate for the slab allocator, + * drop the unsupported bits + */ + mask &= ~(__GFP_DMA32|__GFP_HIGHMEM); state = kmem_cache_alloc(extent_state_cache, mask); if (!state) return state; diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index baa40d34d2c9..d118d4659c28 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8994,7 +8994,7 @@ static int btrfs_releasepage(struct page *page, gfp_t gfp_flags) { if (PageWriteback(page) || PageDirty(page)) return 0; - return __btrfs_releasepage(page, gfp_flags & GFP_NOFS); + return __btrfs_releasepage(page, gfp_flags); } static void btrfs_invalidatepage(struct page *page, unsigned int offset,