From patchwork Tue Nov 3 13:17:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 11877453 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 9E52914B2 for ; Tue, 3 Nov 2020 13:18:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2FF1822243 for ; Tue, 3 Nov 2020 13:18:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tTOigtHP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2FF1822243 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 0238A6B005C; Tue, 3 Nov 2020 08:18:24 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id EF0176B005D; Tue, 3 Nov 2020 08:18:23 -0500 (EST) 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 DB80E6B0070; Tue, 3 Nov 2020 08:18:23 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0050.hostedemail.com [216.40.44.50]) by kanga.kvack.org (Postfix) with ESMTP id ACE5E6B005C for ; Tue, 3 Nov 2020 08:18:23 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 53D228249980 for ; Tue, 3 Nov 2020 13:18:23 +0000 (UTC) X-FDA: 77443160886.10.cakes86_1a0020e272b8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 2C8B916A4A9 for ; Tue, 3 Nov 2020 13:18:23 +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: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;04yrtqzqfiimqrgzu6tqm1sm87ky8ypa8cau1z7eixrwcihqs9jeed1puzccucd.3zh891ssdqr6o714xozgtjn8wdu5ctkssagyauirdwqbz1fs7uy8hf8e6tgxai6.k-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0 ,MSF:not X-HE-Tag: cakes86_1a0020e272b8 X-Filterd-Recvd-Size: 4378 Received: from mail-oi1-f195.google.com (mail-oi1-f195.google.com [209.85.167.195]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Nov 2020 13:18:22 +0000 (UTC) Received: by mail-oi1-f195.google.com with SMTP id 9so18306308oir.5 for ; Tue, 03 Nov 2020 05:18:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=9UeKXLqEROkCIRleEW4NP4O88bOkp9F8082Wrul3qWg=; b=tTOigtHPF0PrG8+kN81ihGfYJxkuRjri2wpmWwfcbEVQ6XDCQcQYVTo/xkUiqB2lbr ieygPmQPOOzugKc5w2+JBDLYOehE6qeYvN8g5rksfeRf7JccJih7mjB1LHgW+BvtKNwg PN57zQk50YIsvH/w6NYV812J5SneXuHrU5EdCGDwR5UDPBw69RuCJE8Paf7W9d3IaTcd 4TlWWBA3qSwMwy0JwVIDR1Nwwxn1NZy23AkV/RE8Hrs8niOg7ZeE1Dz+UI0Inlrz4LP3 GcwNqWpBV2fVcy0RF/+jVsbmhYW/BCayzTbeG7SsVUpNjWyK954kTDA8WnyPujOUfHjN Iq2A== 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=9UeKXLqEROkCIRleEW4NP4O88bOkp9F8082Wrul3qWg=; b=JsdnEChUTccMXSBXANJ8dIL6Y6N5jlGmPkJO0argWveP3U8ccpJCXthRjVHaLyyu6p 4nwiIs37YAAVcx+wmXCIYPOVnOLG6t4ZG7sfYcOBvmaPgLkx0sF1rh6U4hYLAP8KPEVr kPnCEp6ss60WI7yxI2F5wGpQim915fPOhW/UmFtu9PDfbDlDCjGt7RoklCiVbNrr0yBU 1i/vW9pEq7QHzVyKm7t2sfrM4shZU+tWf0UnX+mC8nWQ3+P9EGJ1spKwRE+XInGTBpbX GLroo8UE3RKqQDb4yzPJu6DHgehk1KqCuIaRL2BvvG/pP1rC96xh1nGp9vopoX4H3Ng9 oD2Q== X-Gm-Message-State: AOAM532EXuCmY69hIk5v4l6yBQAzBKoj9RpkO400dMZYqtccz4J3hNT3 h0ZRjcH7F6ii3Bra0IbUZnE= X-Google-Smtp-Source: ABdhPJyHumb6iPyGDVtgaFN1uX6Cr7u6PoFH0nLwJUw4VtW1UirICUj/tSOY/Anb9E3+kc5rJ6ub+A== X-Received: by 2002:aca:f40c:: with SMTP id s12mr1779623oih.153.1604409502024; Tue, 03 Nov 2020 05:18:22 -0800 (PST) Received: from localhost.localdomain ([50.236.19.102]) by smtp.gmail.com with ESMTPSA id f18sm4396138otf.55.2020.11.03.05.18.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2020 05:18:21 -0800 (PST) From: Yafang Shao To: akpm@linux-foundation.org Cc: david@fromorbit.com, hch@infradead.org, darrick.wong@oracle.com, willy@infradead.org, mhocko@kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, Yafang Shao Subject: [PATCH v8 resend 0/2] avoid xfs transaction reservation recursion Date: Tue, 3 Nov 2020 21:17:52 +0800 Message-Id: <20201103131754.94949-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(-)