From patchwork Thu Aug 27 01:34:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 11739799 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 812CF17C7 for ; Thu, 27 Aug 2020 01:34:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4DCBF21741 for ; Thu, 27 Aug 2020 01:34:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sfCu3w1t" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4DCBF21741 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 6B96D6B0002; Wed, 26 Aug 2020 21:34:58 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 66A176B0003; Wed, 26 Aug 2020 21:34:58 -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 559026B0006; Wed, 26 Aug 2020 21:34:58 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0047.hostedemail.com [216.40.44.47]) by kanga.kvack.org (Postfix) with ESMTP id 3CA096B0002 for ; Wed, 26 Aug 2020 21:34:58 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id F2DF28248047 for ; Thu, 27 Aug 2020 01:34:57 +0000 (UTC) X-FDA: 77194629876.17.sheep26_490039e27069 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id C243C180D0181 for ; Thu, 27 Aug 2020 01:34:57 +0000 (UTC) X-Spam-Summary: 1,0,0,74129229fe43e9f1,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.160.194:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100;04yf3pm63eqt46ujbncz1uym6fgw9ocu6fchn9eotj7t4pncmdjeed1puzcpfun.minirrzou8chwq7ehw97uzzgtpguh3e8mimzaiezrutztoucqeux9zbh1gbipso.c-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: sheep26_490039e27069 X-Filterd-Recvd-Size: 4331 Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Thu, 27 Aug 2020 01:34:57 +0000 (UTC) Received: by mail-qt1-f194.google.com with SMTP id k18so3459340qtm.10 for ; Wed, 26 Aug 2020 18:34:57 -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=wLy+bW88Yt+UeLAJkekbjwnN6inFO2kqTqlou1glKoo=; b=sfCu3w1t9MRqXxPwApt7NbPjCmgvic/WoFwplUThrnXHZxTuFSoKmcVXKIBrk8xGxy +K74kZqxqV18vRwuC3NsZRaTHf0vZO5i/MhY//17v2R2L5cI59TDTMvNM7ipmUQPIzTR BIrlxMdgZYm7BEMeTTMX6yLfNIJZ/2JY4cNuXDJ9DPCBonHQTHdF/NDXDlE+Dzw3nplf mM9umZGH0RRG4FXwXovsjwOLC02g3zzSclmBs80E62UVbx0BuAaLcUOfVgb+VYuZD4Ab f8kvp1P421lbs4PjOwF1NT73qKOC8iVdD42wGVP55xAeOmpi1Hz2eD05yetYKVSZ8Zlo n2Xg== 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=wLy+bW88Yt+UeLAJkekbjwnN6inFO2kqTqlou1glKoo=; b=FAfVjmWewu05HWkSp4257TnQBfyyWUln3QXENnAtKd4nSPCarZFTA9bKkxYLSqJdI0 thg+HtWk9m+zP9U61cTmUFCkKswkaSzIWAjafHDk4/ieXU1mrLQG8yJZbYcAsJi/ephr /RJoYzPJKjKE7aeAiuunKlcG50lW6Oz0ve07unjf8Fd6yfcG/ah/GQM477Czd8hZOANp jpFY+7kYOpxMmFNV6Vq/okYQ+GrCW2D2Uw3EA7dZyoqfe7qpyiQ05doo8buKfP42qrnu 1Rez8oAn9Ft8ywM8DTGN6kwkqHpWL83vAvM7s1KlBvPYtsIBiEu15rEa1K9yAgP3ega6 +ytg== X-Gm-Message-State: AOAM533oms1YwfNoGpzvIbHxjBYeYumOktBazxSy4xy/DzSyPQ9w5Luf E8J2EG6kohpvrc+euvwI02w= X-Google-Smtp-Source: ABdhPJyevdcgqqfc3h+7QKmmzaFxNkVoDTNXHTujj3mA88GdzVfRlB5F2vgLQeXJQJ8iZGGdcEt0CA== X-Received: by 2002:aed:3bb3:: with SMTP id r48mr16515536qte.328.1598492096784; Wed, 26 Aug 2020 18:34:56 -0700 (PDT) Received: from localhost.localdomain ([50.236.19.102]) by smtp.gmail.com with ESMTPSA id i18sm631846qtv.39.2020.08.26.18.34.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Aug 2020 18:34:55 -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 v7 0/2] avoid xfs transaction reservation recursion Date: Thu, 27 Aug 2020 09:34:42 +0800 Message-Id: <20200827013444.24270-1-laoar.shao@gmail.com> X-Mailer: git-send-email 2.17.2 (Apple Git-113) X-Rspamd-Queue-Id: C243C180D0181 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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} and fstrans_context_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/ 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 | 4 ++-- fs/xfs/libxfs/xfs_btree.c | 14 ++++++++------ fs/xfs/xfs_aops.c | 11 +++++++++-- fs/xfs/xfs_linux.h | 4 ---- fs/xfs/xfs_trans.c | 19 +++++++++---------- fs/xfs/xfs_trans.h | 30 ++++++++++++++++++++++++++++++ include/linux/sched/mm.h | 23 +++++++++++++++++++++++ include/linux/writeback.h | 3 +++ mm/vmscan.c | 16 +--------------- 9 files changed, 85 insertions(+), 39 deletions(-)