From patchwork Mon Aug 24 01:42:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 11732033 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 834F5913 for ; Mon, 24 Aug 2020 01:43:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4FBDF2078A for ; Mon, 24 Aug 2020 01:43:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ihD/HJk/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FBDF2078A 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 4CE506B0002; Sun, 23 Aug 2020 21:43:09 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 481676B0005; Sun, 23 Aug 2020 21:43:09 -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 396738D0001; Sun, 23 Aug 2020 21:43:09 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0117.hostedemail.com [216.40.44.117]) by kanga.kvack.org (Postfix) with ESMTP id 227156B0002 for ; Sun, 23 Aug 2020 21:43:09 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D07858248047 for ; Mon, 24 Aug 2020 01:43:08 +0000 (UTC) X-FDA: 77183764056.14.soap59_1e0c1052704f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id 9D9C018229835 for ; Mon, 24 Aug 2020 01:43:08 +0000 (UTC) X-Spam-Summary: 1,0,0,a5198606abfa88e1,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.219.65:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100;04y86izd1giuoar1gofy3adpru3kdycff6k4hrqgfabe45hh9k9n8qdhbk7i4hz.e5pm73ndpkupa3to5smbuiikb4bj1q63fufouwtk3xyp81fs7uy8hfytqz7w4sa.e-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF :fp,MSBL X-HE-Tag: soap59_1e0c1052704f X-Filterd-Recvd-Size: 4208 Received: from mail-qv1-f65.google.com (mail-qv1-f65.google.com [209.85.219.65]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Mon, 24 Aug 2020 01:43:08 +0000 (UTC) Received: by mail-qv1-f65.google.com with SMTP id x7so3096753qvi.5 for ; Sun, 23 Aug 2020 18:43:08 -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=7poD9i6PNH3g+ZtHM686iV1Jtq5EUPZ9/Xyx7mrF7Yc=; b=ihD/HJk/AWLQXGZbEG6PVIloI5Y4h7KmJPky2enRUpoHDaICBJrZyQXUrE1J4jSL0B YMJPsMGRh6nIYIbEtmtiFBx0OksjwKJxcKlfo/amkiFVMRAFhGSPFk6aDX4dTBf3G73Z xNgD1mjJl/r71k+rxE7Qs8Da7Ze6VB3NAfXxgcuzLmWhWuz0+QKp6/IBTCYx5s0/LvwH 3SxEFvXs7BmIMJCHm2v85WHoyfUoMmrVfQKI4Rh0hzCV6/YQfzBzyyqABi7JNoR8yt2g kwgGVj3r/KdSEigELXOxp2Okg2cAVmiLOsgEhgpe1f8J5i0hP2NvWeUAeu3XsXyP4UWj jovQ== 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=7poD9i6PNH3g+ZtHM686iV1Jtq5EUPZ9/Xyx7mrF7Yc=; b=UzxZzi/Vm/vVSSsykaISLOcfM2WS/jObKg3tFdVMKGNTXYX76KUcuU5Iz+Kb+EpRzu Vwh2QjHwBiejh5So4eIpMuqWaYhYOXwVXnAJ7lApU5aqzaT0wVrGRSPnfoH9ABm67qoK +A/OQGfWbjxynradWBAWLrY4cNSYSBRhk/iB4I+bQj2BpVzxZHimKnfo5zJnO1fPdwdy TFKVbC++WIq7AlyPR4l8Jhx6tA2esgJhQ8bpbPxEJdGa4AG3kEfEBwfIu2M/2U5wKuVw 3hztEe+PkSAuBE5J4uV335d1rgxJIeXwOmeZhWQ0TFGd1eLy01DYc4AMbkWjUFtCyPd+ d57Q== X-Gm-Message-State: AOAM53020pgwZkGqbaQa+hHUEZJ8zDsov6oPkSWGfiehcHALtsj5aSTC RjfoCP13BRj+rRRP8D1wKEo= X-Google-Smtp-Source: ABdhPJwXmdjnfdpFg+xzLQ5icFJ2gyVNrZWz5WbZy81EL7DD8P7ion9qw6nf3P3MrFM3IqoPe+C0EA== X-Received: by 2002:ad4:54d4:: with SMTP id j20mr2990069qvx.6.1598233387762; Sun, 23 Aug 2020 18:43:07 -0700 (PDT) Received: from localhost.localdomain ([50.236.19.102]) by smtp.gmail.com with ESMTPSA id t8sm10205236qtc.50.2020.08.23.18.42.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Aug 2020 18:43:06 -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 v6 0/2] avoid xfs transaction reservation recursion Date: Mon, 24 Aug 2020 09:42:32 +0800 Message-Id: <20200824014234.7109-1-laoar.shao@gmail.com> X-Mailer: git-send-email 2.17.2 (Apple Git-113) X-Rspamd-Queue-Id: 9D9C018229835 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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/ 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 | 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 | 23 +++++++++++++++++++++++ mm/vmscan.c | 16 +--------------- 9 files changed, 76 insertions(+), 39 deletions(-)