From patchwork Sun Dec 6 06:40:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 11953683 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2549CC4361B for ; Sun, 6 Dec 2020 06:41:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8E5F622ADF for ; Sun, 6 Dec 2020 06:41:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E5F622ADF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 88BC26B005C; Sun, 6 Dec 2020 01:41:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 83B3E6B005D; Sun, 6 Dec 2020 01:41:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 751576B0068; Sun, 6 Dec 2020 01:41:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0183.hostedemail.com [216.40.44.183]) by kanga.kvack.org (Postfix) with ESMTP id 607196B005C for ; Sun, 6 Dec 2020 01:41:21 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2439D362C for ; Sun, 6 Dec 2020 06:41:21 +0000 (UTC) X-FDA: 77561910762.13.metal94_3f08322273d3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id 0450118140B67 for ; Sun, 6 Dec 2020 06:41:20 +0000 (UTC) X-HE-Tag: metal94_3f08322273d3 X-Filterd-Recvd-Size: 4923 Received: from mail-ot1-f68.google.com (mail-ot1-f68.google.com [209.85.210.68]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Sun, 6 Dec 2020 06:41:20 +0000 (UTC) Received: by mail-ot1-f68.google.com with SMTP id y24so9527717otk.3 for ; Sat, 05 Dec 2020 22:41:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4uryp7VoMw6vTHsDBKmQdtkum5EctehoaGW3WLCaGdw=; b=QQDB33x0zV36M+SWfI5ES4b3YenolO4NNKo0ewT+qiFknDVGfmuh4X+HF/+k9nIsBB Qw6+Dm79b05DvtkibIyD+JGWwo5ztQ7buULpNdgoxujU3DDr3/dLFe51W/PW7BwySzoL iggGCjkNV3HAED90FHUpPM1b3MPQST+lxxez5ch9IwUbc0Hhlkd6Qy4fYmmMLJIBlj3/ OaSdeHNG0T1Ngzr8T1R4aiS8n02roo3L14A20aMiBnvqeUpo9h6pomw/RWVSFA6ZYFkn F7I008yXRB9nzCFO96iv/RuX3swPZ8LZe8Vpca0AxoPPQPQ9DBAvqss6boDY9uAb2tDZ /BRQ== 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:mime-version :content-transfer-encoding; bh=4uryp7VoMw6vTHsDBKmQdtkum5EctehoaGW3WLCaGdw=; b=bOpoQOhAMjUoMbWg+yjR+Y7A3n8Z3+LV3uK6fEjdIjqswWmkecdlfwlvyylFZ0mSAF Pi3hbU17t8Wm73ITYVPlxbJmxn4YMpYzng2P0CbBzJIp2dmt0ZB0YcLz7VZOqNE9NzID PxEicjiJOz83zxp0DSOZuPGUO7Kil2NZA17z9BioZNdUz2azaR4mFcfNKKknmqaNDNvL bkuQQocphQUar7tbE+GIa1t/9JwvhqfJkqojWVtP6gH8YzdyFvVfzmHBC7tgd1rNQt8r fPuwRp/SeqpxhjOoLuuQ/1rlw1+GWMpiI/ooZ6FbVWqVOz/UDtEUoW3lnaDVKKrOKRN+ hTZg== X-Gm-Message-State: AOAM5326kLj6kMad6NRapzK9r1+lM7l33eibjMuGQia3JcuVOLcwua8W TaUAp00XFwSvLVhD6sHLvUU= X-Google-Smtp-Source: ABdhPJz0zuQ/HHcKj74pAmZf49zndavOqXdbZx9Dmc3IsyKF1npPcXqG51F8231ukrl21NZjZd7usw== X-Received: by 2002:a9d:708e:: with SMTP id l14mr9199595otj.87.1607236879898; Sat, 05 Dec 2020 22:41:19 -0800 (PST) Received: from localhost.localdomain ([122.225.203.131]) by smtp.gmail.com with ESMTPSA id y18sm1817553ooj.20.2020.12.05.22.41.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 Dec 2020 22:41:19 -0800 (PST) From: Yafang Shao To: darrick.wong@oracle.com, willy@infradead.org, hch@infradead.org, david@fromorbit.com, mhocko@kernel.org, 000akpm@linux-foundation.org, dhowells@redhat.com, jlayton@redhat.com Cc: linux-fsdevel@vger.kernel.org, linux-cachefs@redhat.com, linux-xfs@vger.kernel.org, linux-mm@kvack.org, Yafang Shao Subject: [PATCH v9 0/2] avoid xfs transaction reservation recursion Date: Sun, 6 Dec 2020 14:40:44 +0800 Message-Id: <20201206064046.2921-1-laoar.shao@gmail.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This patchset avoids transaction reservation recursion by reintroducing the discarded PF_FSTRANS in a new way, suggested by Dave. In this new implementation, some new helpers are introduced, which are xfs_trans_context_{set, clear, active}, suggested by Dave. And re-using the task->journal_info to indicates whehter the task is in fstrans or not, suggested by Willy Darrick helped fix the error occurred in xfs/141.[2] I rerun the xfstests again in my server, and no obvious error occurred. Patch #1 is picked from Willy's patchset "Overhaul memalloc_no*"[1] [1]. https://lore.kernel.org/linux-mm/20200625113122.7540-1-willy@infradead.org/ [2]. https://lore.kernel.org/linux-xfs/20201104001649.GN7123@magnolia/#t v9: - rebase it on xfs tree. - Darrick fixed an error occurred in xfs/141 - run xfstests, and no obvious error occurred. v8: - check xfs_trans_context_active() in xfs_vm_writepage(s), per Dave. v7: - check fstrans recursion for XFS only, by introducing a new member in struct writeback_control. v6: - add Michal's ack and comment in patch #1. v5: - pick one of Willy's patch - introduce four new helpers, per Dave v4: - retitle from "xfs: introduce task->in_fstrans for transaction reservation recursion protection" - reuse current->journal_info, per Willy Matthew Wilcox (Oracle) (1): mm: Add become_kswapd and restore_kswapd Yafang Shao (1): xfs: avoid transaction reservation recursion fs/iomap/buffered-io.c | 7 ------- fs/xfs/libxfs/xfs_btree.c | 14 ++++++++------ fs/xfs/xfs_aops.c | 23 +++++++++++++++++++++-- fs/xfs/xfs_linux.h | 4 ---- fs/xfs/xfs_trans.c | 25 +++++++++++++------------ fs/xfs/xfs_trans.h | 23 +++++++++++++++++++++++ include/linux/sched/mm.h | 23 +++++++++++++++++++++++ mm/vmscan.c | 16 +--------------- 8 files changed, 89 insertions(+), 46 deletions(-)