From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=no 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 1EB2FC433DF for ; Fri, 9 Oct 2020 12:51:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8082C222BA for ; Fri, 9 Oct 2020 12:51:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RQzHlfvo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8082C222BA 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 D69C16B005D; Fri, 9 Oct 2020 08:51:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CF2B36B006C; Fri, 9 Oct 2020 08:51:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBA116B006E; Fri, 9 Oct 2020 08:51:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0106.hostedemail.com [216.40.44.106]) by kanga.kvack.org (Postfix) with ESMTP id 8BA586B005D for ; Fri, 9 Oct 2020 08:51:50 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 295AD1EE6 for ; Fri, 9 Oct 2020 12:51:50 +0000 (UTC) X-FDA: 77352373980.28.ducks13_4313b38271e0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 0574B6C11 for ; Fri, 9 Oct 2020 12:51:49 +0000 (UTC) X-HE-Tag: ducks13_4313b38271e0 X-Filterd-Recvd-Size: 4366 Received: from mail-oi1-f195.google.com (mail-oi1-f195.google.com [209.85.167.195]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Fri, 9 Oct 2020 12:51:49 +0000 (UTC) Received: by mail-oi1-f195.google.com with SMTP id m7so10127589oie.0 for ; Fri, 09 Oct 2020 05:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=8fOXq+e8Q3qUvkqCfbrJcARvOZ9gZJoH7zIPzq8Gvzg=; b=RQzHlfvoOI/QVLRXucLrWfIVUWtm4cpVnGLkxI1eDV5ttT49jgQT520oAITBxK/uUh 7heTOyU7jek5K2D5JToiQrZzEFRU6GsJLCTnWtLo0cLsOvFDDEt9P2hPvKWvBc5XcbAz xOmOBX2B7wopclEICJF8FkXwN2LXzXrgS6H+jzksNBEWZQABiNBZKYVyuL2n2Hpx2IWU SGfidHq6Ed0ZetxIq0+ez9eVJID+H5PY/A6xZCz+pebwp/LtcGVejfoi8819LVFGO+G9 0YRL3IRt1zFQdcYsMvmRu3Ch8Wj+Al2js3osGsi4BglUUzAgiTXwo9UTDOrGO+MqKux3 EIlg== 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=8fOXq+e8Q3qUvkqCfbrJcARvOZ9gZJoH7zIPzq8Gvzg=; b=F8rV8dJfdiUJtwZPtCWS1fSBLHWDEhyUzdnbylAy43UBc8TSAg/WInYsFT5PkOSCE9 /teHnz0CVlVfrWlmFtTWCNl1taOGwcxfNed0fxeYmMzQWKFVsj1Tm7nwCqUp9JldJMXo WZk0/jcF0CvwPpMcoSFjUe7wsIYW9KyjG4/1bZtxahsgodED/aZVa5dLZJ/fVOCQUqbR 5phCvoZBG9dcCIHF3CJjnVXRytJ/JMtA+4zpjVzRyTpo9kpds1MC/Wvrrsl+i7cmYZCd dsmF/NIl0s1FryOTxQzzRP37hwIDXy5Xt1OmsVsl+jJQJjNKAOenXzqq3+ZcsBAF0raE UPaQ== X-Gm-Message-State: AOAM531IJT9bcLVrF4xY40ZZ4UNjlFDLHegXpX/7YJiOa6vLU+CslPP8 XvbWnUg8NR6TsC67vIjyTMM= X-Google-Smtp-Source: ABdhPJxGsrm06i2I/qV/lMSAXI3+iYKhtb9rXqg+sZXxU00Rb1IKhFCUZBQWuBV9j+e4+kGoUdEX4g== X-Received: by 2002:aca:bbc3:: with SMTP id l186mr2410876oif.112.1602247908986; Fri, 09 Oct 2020 05:51:48 -0700 (PDT) Received: from localhost.localdomain ([50.236.19.102]) by smtp.gmail.com with ESMTPSA id l25sm6736861otb.4.2020.10.09.05.51.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Oct 2020 05:51:48 -0700 (PDT) From: Yafang Shao To: david@fromorbit.com, hch@infradead.org, darrick.wong@oracle.com, willy@infradead.org, mhocko@kernel.org, akpm@linux-foundation.org Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Yafang Shao Subject: [PATCH v8 0/2] avoid xfs transaction reservation recursion Date: Fri, 9 Oct 2020 20:51:25 +0800 Message-Id: <20201009125127.37435-1-laoar.shao@gmail.com> X-Mailer: git-send-email 2.17.2 (Apple Git-113) 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, four new helpers are introduced, which are xfs_trans_context_{set, clear, update, active}, suggested by Dave. And re-using the task->journal_info to indicates whehter the task is in fstrans or not, suggested by Willy 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/ 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 | 19 +++++++++---------- fs/xfs/xfs_trans.h | 30 ++++++++++++++++++++++++++++++ include/linux/sched/mm.h | 23 +++++++++++++++++++++++ mm/vmscan.c | 16 +--------------- 8 files changed, 92 insertions(+), 44 deletions(-) -- 2.17.1