From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E88B3C433DF for ; Thu, 27 Aug 2020 02:42:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B43342078D for ; Thu, 27 Aug 2020 02:42:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B43342078D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fromorbit.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 53FED6B0006; Wed, 26 Aug 2020 22:42:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F15E6B0007; Wed, 26 Aug 2020 22:42:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 406B66B0008; Wed, 26 Aug 2020 22:42:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0090.hostedemail.com [216.40.44.90]) by kanga.kvack.org (Postfix) with ESMTP id 29F9B6B0006 for ; Wed, 26 Aug 2020 22:42:55 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id DF9F64427 for ; Thu, 27 Aug 2020 02:42:54 +0000 (UTC) X-FDA: 77194801068.03.pump03_111639227069 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id AF54128A4E8 for ; Thu, 27 Aug 2020 02:42:54 +0000 (UTC) X-HE-Tag: pump03_111639227069 X-Filterd-Recvd-Size: 3629 Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Thu, 27 Aug 2020 02:42:54 +0000 (UTC) Received: from dread.disaster.area (pa49-181-146-199.pa.nsw.optusnet.com.au [49.181.146.199]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id AEE4B1AAE38; Thu, 27 Aug 2020 12:42:51 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1kB7sG-0004YQ-2C; Thu, 27 Aug 2020 12:42:48 +1000 Date: Thu, 27 Aug 2020 12:42:48 +1000 From: Dave Chinner To: Yafang Shao Cc: Matthew Wilcox , Christoph Hellwig , "Darrick J. Wong" , Michal Hocko , Andrew Morton , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, Linux MM Subject: Re: [PATCH v7 2/2] xfs: avoid transaction reservation recursion Message-ID: <20200827024248.GA12131@dread.disaster.area> References: <20200827013444.24270-1-laoar.shao@gmail.com> <20200827013444.24270-3-laoar.shao@gmail.com> <20200827015853.GA14765@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=KcmsTjQD c=1 sm=1 tr=0 cx=a_idp_d a=GorAHYkI+xOargNMzM6qxQ==:117 a=GorAHYkI+xOargNMzM6qxQ==:17 a=kj9zAlcOel0A:10 a=y4yBn9ojGxQA:10 a=JfrnYn6hAAAA:8 a=7-415B0cAAAA:8 a=Z0vDNPQScCoZdydbpagA:9 a=CjuIK1q_8ugA:10 a=1CNFftbPRP8L7MoqJWF3:22 a=biEYGPWJfzWAr4FL6Ov7:22 X-Rspamd-Queue-Id: AF54128A4E8 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: On Thu, Aug 27, 2020 at 10:13:15AM +0800, Yafang Shao wrote: > On Thu, Aug 27, 2020 at 9:58 AM Matthew Wilcox wrote: > > > > On Thu, Aug 27, 2020 at 09:34:44AM +0800, Yafang Shao wrote: > > > @@ -1500,9 +1500,9 @@ iomap_do_writepage(struct page *page, struct writeback_control *wbc, void *data) > > > > > > /* > > > * Given that we do not allow direct reclaim to call us, we should > > > - * never be called in a recursive filesystem reclaim context. > > > + * never be called while in a filesystem transaction. > > > */ > > > - if (WARN_ON_ONCE(current->flags & PF_MEMALLOC_NOFS)) > > > + if (WARN_ON_ONCE(wbc->fstrans_recursion)) > > > goto redirty; > > > > Erm, Dave said: > > > > > I think we should just remove > > > the check completely from iomap_writepage() and move it up into > > > xfs_vm_writepage() and xfs_vm_writepages(). > > > > ie everywhere you set this new bit, just check current->journal_info. > > > I can't get you. Would you pls. be more specific ? > > I move the check of current->journal into xfs_vm_writepage() and > xfs_vm_writepages(), and I think that is the easiest way to implement > it. > > /* we abort the update if there was an IO error */ > @@ -564,6 +565,9 @@ xfs_vm_writepage( > { > struct xfs_writepage_ctx wpc = { }; > > + if (xfs_trans_context_active()) > + wbc->fstrans_recursion = 1; <<< set for XFS only. > + > return iomap_writepage(page, wbc, &wpc.ctx, &xfs_writeback_ops); Get rid of wbc->fstrans_recursion. Just do if (WARN_ON_ONCE(current->journal_info)) ..... right here in the XFS code. Cheers, Dave. -- Dave Chinner david@fromorbit.com