From patchwork Wed Aug 19 02:24:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 11722379 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 666BE13B1 for ; Wed, 19 Aug 2020 02:25:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 333592086A for ; Wed, 19 Aug 2020 02:25:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nHgm/mJZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 333592086A 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 4A1216B0010; Tue, 18 Aug 2020 22:25:08 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4299C6B0071; Tue, 18 Aug 2020 22:25:08 -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 2F1396B0073; Tue, 18 Aug 2020 22:25:08 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by kanga.kvack.org (Postfix) with ESMTP id 161036B0010 for ; Tue, 18 Aug 2020 22:25:08 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C96501EF1 for ; Wed, 19 Aug 2020 02:25:07 +0000 (UTC) X-FDA: 77165725854.11.crime56_33160e627024 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 9D42B180F8B81 for ; Wed, 19 Aug 2020 02:25:07 +0000 (UTC) X-Spam-Summary: 1,0,0,b512ee3265ede4f1,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:4321:4384:4605:5007:6120:6261:6653:7875:7901:7903:7974:9025:9413:10004:11026:11658:11914:12043:12048:12291:12296:12297:12438:12517:12519:12555:12679:12895:12986:13069:13161:13229:13311:13357:14096:14181:14384:14394:14687:14721:21080:21325:21433:21444:21451:21627:21666:21749:21811:30054:30070,0,RBL:209.85.160.194:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.100;04y8xma8zqnd1dpcjwf6cqtmdif1focff6k4hrqgfabe45hh9k9n8qdhbk7sioh.terswz1dpkupa3to5smbuiikb7guh3e8mimouwtk3xyp81fs7uy8hf8bkzxqot5.w-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SP F:fp,MSB X-HE-Tag: crime56_33160e627024 X-Filterd-Recvd-Size: 4169 Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Wed, 19 Aug 2020 02:25:07 +0000 (UTC) Received: by mail-qt1-f194.google.com with SMTP id c12so16770152qtn.9 for ; Tue, 18 Aug 2020 19:25:07 -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=PLLOaOgVNnID3QXM3kUkbmSP8c/OOIpuGrT3lZm4CqI=; b=nHgm/mJZEQRbeQELjDqcKlYJOVeRWDm0gLIN/z66tFQDdSWcn6yGPtwucT39Zf2/k6 C3EU1wTh0XINSsyrOWGAut8y9T0It3+hnGIXO77Nb/jULGN7Wb2d+Jif56mA0sKM6HlU zJ8Q3m7xamfjeVyQloD44/Upbifl+9n49kaYtwnIApvm5lCaYUo0U9ZsdeiVejwTAcuT tbVZeZzefT+fskNEiUILsaJegLn42/aUPeJI8PB2v8ZazJ0/6yKswkz6zBPlm1DsGlUE Br2WLlpqhcGKjn6wd+Rz4We9Gq/60CNSb8VIbG8CRR9yiDH6BhrvgTNVf2HbyWXoO+SI kuQQ== 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=PLLOaOgVNnID3QXM3kUkbmSP8c/OOIpuGrT3lZm4CqI=; b=JqDwRUkBbajqraIkhm5GsTpmSR0ZOVwol6dWn60xvSbeflopGAxi21VJRNSe1jO6HU AgBDGfBvEMu0CmHBcg1r3sBwxz2/f/ZqqqKmFO0eWA/26+1Um0L5x+HD9NGU8ycoWKEc fjJu3vW8gEnTvW5mksU/GIhM5YKfE219AX0327nZsIEqyZ1N8K9jxwGF8I39SoqEgAB4 FUKhE2266okz26jTwAechft7euln8uOeqTjGwPP2tngkNqUusqo50xqE2qFgh7Yidanf VA3fnqvGxI4PrZNzKvGNSI4hSOOcoaSM91atfJHi4PNO5XwBFwizedQyO+cI39xixFm1 o46g== X-Gm-Message-State: AOAM531bqRn+yyewQSrEnBnKFBBpw9hrPcKdCr8Nx3To/lXQkcc0/ggr Y/uWpfdlR1cVxRv4NyyOfjk= X-Google-Smtp-Source: ABdhPJxFjirsZc1zvcv45u2qvsH4ABMVQtT5B5aZp7o0nV/XgXIiE8i/cu/k4V7yT+3RMpReUh+rlQ== X-Received: by 2002:ac8:581:: with SMTP id a1mr20889841qth.247.1597803906532; Tue, 18 Aug 2020 19:25:06 -0700 (PDT) Received: from localhost.localdomain ([50.236.19.102]) by smtp.gmail.com with ESMTPSA id t12sm21988275qkt.56.2020.08.18.19.24.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Aug 2020 19:25:05 -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 v5 0/2] avoid xfs transaction reservation recursion Date: Wed, 19 Aug 2020 10:24:23 +0800 Message-Id: <20200819022425.25188-1-laoar.shao@gmail.com> X-Mailer: git-send-email 2.17.2 (Apple Git-113) X-Rspamd-Queue-Id: 9D42B180F8B81 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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/ 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 | 5 +++-- fs/xfs/xfs_linux.h | 4 ---- fs/xfs/xfs_trans.c | 19 +++++++++---------- fs/xfs/xfs_trans.h | 23 +++++++++++++++++++++++ include/linux/iomap.h | 7 +++++++ include/linux/sched/mm.h | 28 ++++++++++++++++++++++++++++ mm/vmscan.c | 16 +--------------- 9 files changed, 81 insertions(+), 39 deletions(-)