From patchwork Fri Oct 9 12:51:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 11825777 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 586DD109B 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 ECECF222C2 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 ECECF222C2 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) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CF2B36B006C; Fri, 9 Oct 2020 08:51:50 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org 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-Original-To: linux-mm@kvack.org 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-Spam-Summary: 1,0,0,66b53b5bdf743d0f,d41d8cd98f00b204,laoar.shao@gmail.com,,RULES_HIT:41:69:355:379:541:800:967:973:988:989:1260:1345:1437:1534:1541:1711:1730:1747:1777:1792:2393:2525:2559:2563:2682:2685:2859:2895:2897:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3870:3871:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4384:4605:5007:6119:6120:6261:6653:7875:7901:7903:7974:9025:9413:10004:11026:11658:11914:12043:12048:12291:12296:12297:12438:12517:12519:12555:12679:12683:12895:12986:13069:13161:13229:13311:13357:14096:14181:14384:14394:14687:14721:21080:21325:21433:21444:21451:21627:21666:21749:21811:21972:30054:30070,0,RBL:209.85.167.195:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100;04y8ot9bhwddzwc9rwrtpcn9bk66yopa8cau1z7eixrwcihqs9jeed1puzccucd.3zh891ssdqr6o714xozgtjn8wdu5ctkssagyauirdwqbz1fs7uy8hf8e6tgxai6.k-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainC ache:0,M 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(-)