Received: by 2002:a17:90a:b81:0:0:0:0 with SMTP id 1csp673731pjr; Fri, 9 Aug 2019 04:31:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDJtluVJJvbr0YhLh/8lVuQ7JvT1VGc+PjDnSCzclLGUvoNSkhNbo3hyo7J2CQAXc040zt X-Received: by 2002:a65:5b8e:: with SMTP id i14mr17002794pgr.188.1565350287353; Fri, 09 Aug 2019 04:31:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565350287; cv=none; d=google.com; s=arc-20160816; b=EZ9xhIBpQ8DrKih4ohowbRGiz9dMPo3cbu6O9IgSv/eDark/1Hs8wuGHA05zmRoUqG W7rmIqc/iybusjXbJdg8NAYvidCKWq4XyADhmq0szovPgRpV6DuV3AKH+DXdA+IjEgbC 9XfiM1kb5OqiT75gm6RZQfq+5yL+LclfejMhDmgqAabRWN3ap2emlnvJ9Umji643RGrR 0tWD2hy9+L06VCvMaPQfx+UGSgmHQQAt1u4RnvNKtUHvxFCU3P7ipySUSE4eUoyF2bdM xmcAlZK66g40kz13tKgRsyQPquosh/sHhePVH+vvK7h2Yd8I7PrDKUg7/tTqLSnYMP3I Ik0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=ZjB3qW50yiy03Jc4dylH6Xf+dM2BPU68ZYItgE7LtTI=; b=kRE8g+/Si8kpB9bOi4xzGpMBVgsJv075sVTQuiGz02YoMRpz9aVMEicsAOYPyVJtHZ 4cBtFF3rsTMjk8jJhjlLdBqD0RqZ4X+tl8Iv/H3xCqhyKpxBsVHZmkEbIEhx63+EpOz/ v329Qf2BurpKKOSQKB/Fvw/9HczlwaiSY3QmH0L60SA68LsRPSZYr0c+YU0geXHffd1I FWEpt+zYZMjqkMtrpCwYj4VQiaTpNtEsRe9PQYHpNcahjgF0yMZmUUuYhz3Ufm4WoXR8 lFTBNFEn57mrON+1fNGCOh29YjdfMn8anVC1o/Ez6qgK5lsuUuQhhAgaT+oWavWjqa2Y hrQA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a33si55712856pgl.436.2019.08.09.04.31.12; Fri, 09 Aug 2019 04:31:27 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406598AbfHILaF (ORCPT + 99 others); Fri, 9 Aug 2019 07:30:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33476 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406588AbfHILaE (ORCPT ); Fri, 9 Aug 2019 07:30:04 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6A1313172D8C; Fri, 9 Aug 2019 11:30:04 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A74677E51; Fri, 9 Aug 2019 11:30:01 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id x79BU1n9032319; Fri, 9 Aug 2019 07:30:01 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id x79BU0Ct032315; Fri, 9 Aug 2019 07:30:01 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Fri, 9 Aug 2019 07:30:00 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Dave Chinner 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 In-Reply-To: <20190809013403.GY7777@dread.disaster.area> Message-ID: References: <20190809013403.GY7777@dread.disaster.area> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 09 Aug 2019 11:30:04 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: * it uses trylock to acquire the mutex * it doesn't attempt to free buffers that are dirty or under I/O (see __try_evict_buffer) I think that this logic is sufficient to prevent the deadlock. Mikulas