Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp845846ybl; Fri, 9 Aug 2019 15:00:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXuxgL1Ggs12kPMFUP3GUh2u1GEjGfQT11lvsW9UrsNcYnMNRF00RbvHBolDl7aRUJPiNK X-Received: by 2002:a17:90a:3590:: with SMTP id r16mr11612822pjb.44.1565388002027; Fri, 09 Aug 2019 15:00:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565388002; cv=none; d=google.com; s=arc-20160816; b=BeRY6zy/kVreJpA4f0Ix8bzv9aH60OvTp8KT7UzikzP8TOJzZl7UsHzMthivxAgnp3 GiddBfSdUYIyzFnrvLzkewv4KYBiVs5/vKHQUSWVlRGbf4md+NWvXBXhlThpCRzjQZwk n26QNTFDf+gsLxlOMYsXIqNBqKITuMdcBhSR6euKJ5KM1BBzS5A/PSVaP+Xq47lmrE+F /II3xcPfFg5pInXSIHIWb/Ir+6VQb/DkLSNkiztLtwlps4k04K1VG5YTXD3CqSuubA2j 0eRCLZofVBCdkgREPwknuceOmP5zZyLfBW6j9zHCfhNV74h93odyjRDzfuHSNRKX4IMU UaYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=9gCjYY/sbx8CzNK9QKVL5fgYqmWvd+BVL3pQW0ZO6yc=; b=tvWS2MF76SHDzTQQN7xq8A2eebv7lqiBQPLsXIOZfOBjzwpkQmRC412+oRGEJayF3S muGmo2/CcmX+ovokj3I3MNh4eKgnjIzNsc1j8j0AerXneZtbZHlaWNy3l2EBdJI0WW1o bimCZqerIERR1izrzAZJpoULVCSYoZZiUiCsLetOQnU0mTTCCf/DaIVYj3X0kV7tO+Un LmLE/EA7TyBW/A9kE4RW7Qfz9wsNXcV5W5gkfvUE6tUX4I0xuQqNl+vu/kWgmXrhS6Ql XYu7NDXSbXiuongIpfyz2Y+MRuIToxNTgGAblKcehIu4NrWSH451XYXnblMGaGwwARDU 5/iQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w1si56015474pfn.129.2019.08.09.14.59.46; Fri, 09 Aug 2019 15:00:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728227AbfHIV6q (ORCPT + 99 others); Fri, 9 Aug 2019 17:58:46 -0400 Received: from mail104.syd.optusnet.com.au ([211.29.132.246]:43792 "EHLO mail104.syd.optusnet.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726219AbfHIV6p (ORCPT ); Fri, 9 Aug 2019 17:58:45 -0400 Received: from dread.disaster.area (pa49-181-167-148.pa.nsw.optusnet.com.au [49.181.167.148]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 00E157E96C0; Sat, 10 Aug 2019 07:58:41 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92) (envelope-from ) id 1hwCtB-0000wW-Tv; Sat, 10 Aug 2019 07:57:33 +1000 Date: Sat, 10 Aug 2019 07:57:33 +1000 From: Dave Chinner To: Mikulas Patocka Cc: Alexander Viro , "Darrick J. Wong" , Mike Snitzer , junxiao.bi@oracle.com, dm-devel@redhat.com, Alasdair Kergon , honglei.wang@oracle.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH] direct-io: use GFP_NOIO to avoid deadlock Message-ID: <20190809215733.GZ7777@dread.disaster.area> References: <20190809013403.GY7777@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=gu9DDhuZhshYSb5Zs/lkOA==:117 a=gu9DDhuZhshYSb5Zs/lkOA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=FmdZ9Uzk2mMA:10 a=VwQbUJbxAAAA:8 a=7-415B0cAAAA:8 a=pai4EEcvdAjdbTSEN-UA:9 a=CjuIK1q_8ugA:10 a=AjGcO6oz07-iQ99wixmX:22 a=biEYGPWJfzWAr4FL6Ov7:22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 09, 2019 at 07:30:00AM -0400, Mikulas Patocka wrote: > > > On Fri, 9 Aug 2019, Dave Chinner wrote: > > > And, FWIW, there's an argument to be made here that the underlying > > bug is dm_bufio_shrink_scan() blocking kswapd by waiting on IO > > completions while holding a mutex that other IO-level reclaim > > contexts require to make progress. > > > > Cheers, > > > > Dave. > > The IO-level reclaim contexts should use GFP_NOIO. If the dm-bufio > shrinker is called with GFP_NOIO, it cannot be blocked by kswapd, because: No, you misunderstand. I'm talking about blocking kswapd being wrong. i.e. Blocking kswapd in shrinkers causes problems because th ememory reclaim code does not expect kswapd to be arbitrarily delayed by waiting on IO. We've had this problem with the XFS inode cache shrinker for years, and there are many reports of extremely long reclaim latencies for both direct and kswapd reclaim that result from kswapd not making progress while waiting in shrinkers for IO to complete. The work I'm currently doing to fix this XFS problem can be found here: https://lore.kernel.org/linux-fsdevel/20190801021752.4986-1-david@fromorbit.com/ i.e. the point I'm making is that waiting for IO in kswapd reclaim context is considered harmful - kswapd context shrinker reclaim should be as non-blocking as possible, and any back-off to wait for IO to complete should be done by the high level reclaim core once it's completed an entire reclaim scan cycle of everything.... What follows from that, and is pertinent for in this situation, is that if you don't block kswapd, then other reclaim contexts are not going to get stuck waiting for it regardless of the reclaim context they use. Cheers, Dave. -- Dave Chinner david@fromorbit.com