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=-0.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 45F3AC433E0 for ; Tue, 9 Jun 2020 15:37:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E4E2F20801 for ; Tue, 9 Jun 2020 15:37:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XMzHXf6U" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E4E2F20801 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 53B656B0002; Tue, 9 Jun 2020 11:37:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4EC006B0003; Tue, 9 Jun 2020 11:37:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D9956B0005; Tue, 9 Jun 2020 11:37:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0001.hostedemail.com [216.40.44.1]) by kanga.kvack.org (Postfix) with ESMTP id 1B0A46B0002 for ; Tue, 9 Jun 2020 11:37:18 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C28471856CCC8 for ; Tue, 9 Jun 2020 15:37:17 +0000 (UTC) X-FDA: 76910077314.29.kiss40_62110b626dc3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id 9D102181D68A9 for ; Tue, 9 Jun 2020 15:37:17 +0000 (UTC) X-HE-Tag: kiss40_62110b626dc3 X-Filterd-Recvd-Size: 4436 Received: from mail-il1-f196.google.com (mail-il1-f196.google.com [209.85.166.196]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Tue, 9 Jun 2020 15:37:17 +0000 (UTC) Received: by mail-il1-f196.google.com with SMTP id 9so20709256ilg.12 for ; Tue, 09 Jun 2020 08:37:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9VUTuEo+U6AjQfgdqE+kag2R4dJmyY/gX0I9on+4qYQ=; b=XMzHXf6UF1rT8rlEr/+kWEMnMoxVA3NmD9Kp4d9gRO/ml7/I5JBP2eyEnGso/PCpsS 0JQdF5qEc+bWWBgm2TeJXwu86fGPV2ALPsG+u5rumiwiG9/I6uYIBeA8a7Z16J2kbwV2 xgKQAV7zQGT3mU+R28MGjdNGgqnhJa4VgA/wEcVDg3Azk/bSsKBjyManNh3CJC8aDGSO xfmx2jrA6BL7RXF5sCdWHFxXQcGY0b8wMxi/w8JKMuLiEocsMqcH8wg4CJrPrvTCiYeD 9sKkN9crqjpVphJSPhTvq48S57Q+P6kHsy/lrH22lEbYr+vrxDt/sjY6X7qVsjm1korI fu/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9VUTuEo+U6AjQfgdqE+kag2R4dJmyY/gX0I9on+4qYQ=; b=KAtF3E2pDBEQDNrlu9UDzYuCDuq3TZeYmeBTeCqjws3Qv1c5Pp22TP3qgAiaEWJLVu +ptPvbe1IZl4MMkO8PXqHBuEZGreU8hzASRoHNXvzSXESc4Cf5IjbqeuYhNQjWZchjb3 UQLPie04Ty4KO0E+UOs6CLDTk5wT3e9+4IC/42e4kE3ZJxYt+hWshVyrY2VSXYJ1f06s iaw+qduxHemmjnQz8oShYIbSxahWInpBvAFSRsm2Ftz8Nay/aZ8m/y+x7RkA1D8TzrhL KmZOdsJMBFkrzBBNGmE3jOT5FtvOk1i6KOvqin2bFzpznbsH4jKV7TRp8wGZpJFh+g9j g8cw== X-Gm-Message-State: AOAM532pX0RZ5QxhN/NakIfFV8u6L6w63nNiuc+Zyo1EeQpNpN3QMq0r Tx5y9ohYeLEnIFQxP5ww2Vv4TubJt+RO9Aoyy4A= X-Google-Smtp-Source: ABdhPJwCD4q8IzTdVyGuBGb4l8OE121opqXhW4x8c9rSDbQ89q5a7oQdr68/IHH7SRmXTHMo+OpWZaLUoBU4XDmq0Ik= X-Received: by 2002:a92:4899:: with SMTP id j25mr28737084ilg.168.1591717036418; Tue, 09 Jun 2020 08:37:16 -0700 (PDT) MIME-Version: 1.0 References: <1591254347-15912-1-git-send-email-laoar.shao@gmail.com> <20200609140304.GA11626@infradead.org> <20200609143211.GA22303@infradead.org> In-Reply-To: <20200609143211.GA22303@infradead.org> From: Yafang Shao Date: Tue, 9 Jun 2020 23:36:40 +0800 Message-ID: Subject: Re: [PATCH v2] iomap: avoid deadlock if memory reclaim is triggered in writepage path To: Christoph Hellwig , Michal Hocko , Andrew Morton Cc: "Darrick J. Wong" , Dave Chinner , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, Linux MM Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 9D102181D68A9 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: On Tue, Jun 9, 2020 at 10:32 PM Christoph Hellwig wrote: > > On Tue, Jun 09, 2020 at 10:28:06PM +0800, Yafang Shao wrote: > > On Tue, Jun 9, 2020 at 10:03 PM Christoph Hellwig wrote: > > > > > > On Thu, Jun 04, 2020 at 03:05:47AM -0400, Yafang Shao wrote: > > > > Recently there is a XFS deadlock on our server with an old kernel. > > > > This deadlock is caused by allocating memory in xfs_map_blocks() while > > > > doing writeback on behalf of memroy reclaim. Although this deadlock happens > > > > on an old kernel, I think it could happen on the upstream as well. This > > > > issue only happens once and can't be reproduced, so I haven't tried to > > > > reproduce it on upsteam kernel. > > > > > > The report looks sensible, but I don't think the iomap code is the > > > right place for this. Until/unless the VM people agree that > > > ->writepages(s) generally should not recurse into the fs I think the > > > low-level file system allocating is the right place, so xfs_map_blocks > > > would seem like the correct place. > > > > Thanks for your comment. > > That is what I did in the previous version [1]. > > So should I resend the v1 ? > > Well, v1 won't apply. But I do prefer the approach there. All right. Let's include MM maintainers and see the opinion from them. Hi Michal, Andrew, What's your opinion on this XFS deadlock ? Should ->writepages(s) generally not recurse into the fs ? -- Thanks Yafang