Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp25289ybm; Mon, 20 May 2019 11:11:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQLd+gL/ac94iiWXwspGokk05kTbZ2iSSOx4fgmECoFzyK4Qnwi3H7o9PtzXm5i3czBYK4 X-Received: by 2002:a17:902:8e87:: with SMTP id bg7mr69883892plb.281.1558375878169; Mon, 20 May 2019 11:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558375878; cv=none; d=google.com; s=arc-20160816; b=IEfiYEL2TGAVByTiZ4y71FgTySrke7wNmkGWiPbzAQpln3AI3SySZT5n5XSvyFdia9 Q+2hMt+3DDqO4v5Ljqh59kVFwJzBxlAhpguIdf0mjeeg2CK8XfPdstjw6Pe/7CYHiuyY gNNe5sHT+LdBQOm0p6oLky7SOp1Dnh1XTR3+pLxIg9HbQUhqLC0kqZlfVuxHuOGaWN54 uNmI4HOl9uiOJKa/A1FujzVIfFQs2iLWSdBsr8O0T38Kh1OaVC8xkZYskRVXSp18dQ8f bT4Gm66qT/c64wfLT71qIsu8lWsUuCT64Z+BQ/vH4g/5SP9h+fW4wAKiGdGM4ahfGUA6 uUrw== 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:dkim-signature; bh=OatVHIrCWYguW9Na7RTRuHTBGkcI0B4NqgZ1cLxhQgQ=; b=M6NbLRs083BPoiQrEoX4q5Tr6OhUZ39wySNPa3Ug2JQMlqa7FeAhiSFpi9YWeae/Jw 52qoesVHUzvVj2n0KHCpNZdei0KUM8oUQx74/kkFXdi4ebUb5bmDvY31aYFygMgYQ5hn g4G3B7rk6SocEko0Jr7yy4glou6JT3MZCi6noq5/QNWfxdP5n4Had+Hr0GkXLxSrWY9v GmqM2szF57f8TloF67ZqxrxRDI9zICp9wAkJZbJeIH1OAMhdpyoZ8OOTGG7n1zJ3wC7p ymHeDmzqqPuOavtv8Vy3XWKN1ff+emGv5AwvB4Z57b4mjZ89JZvFchzvRGEuC3KjIknB WkqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=F6Qxfkwn; 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 g9si17167228pgs.364.2019.05.20.11.11.03; Mon, 20 May 2019 11:11:18 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=F6Qxfkwn; 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 S2391444AbfETOXz (ORCPT + 99 others); Mon, 20 May 2019 10:23:55 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:60016 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732127AbfETOXj (ORCPT ); Mon, 20 May 2019 10:23:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=OatVHIrCWYguW9Na7RTRuHTBGkcI0B4NqgZ1cLxhQgQ=; b=F6QxfkwnuYixy1VbMF0FyONlO dsWCZHGjFMaTg+CXsiL17P09p9tVTwmdejillTJOVKTk/anWvWL7/2Hjnuh5LWjmsNBcyVvck9ejw qRag5Wnz4m1LXhBpxrUmjVbrTKqVDVxM3SLJ5hRyo/66WXxDBVFYyNwcKp+0msVjFMiON4shXUf5H vbUY6T4yOTY7RrgQqYAH4p/LVBT6jkqdtXedMJk6ExQoBvbX8XFofYNevHhct2O6nnOdHeb742/3u cTM60s4nWRGiMl3Wt1xdFEVJ5qZgbUd+XZapkxqz3GuRKvPS5fpJirF6QQ06yJccuyRVkv3a1PPwd Mke8wj0lw==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSjCN-0003ZB-Ee; Mon, 20 May 2019 14:23:31 +0000 Date: Mon, 20 May 2019 07:23:31 -0700 From: Christoph Hellwig To: Alan Stern Cc: Christoph Hellwig , Oliver Neukum , Jaewon Kim , linux-mm@kvack.org, gregkh@linuxfoundation.org, Jaewon Kim , m.szyprowski@samsung.com, ytk.lee@samsung.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [RFC PATCH] usb: host: xhci: allow __GFP_FS in dma allocation Message-ID: <20190520142331.GA12108@infradead.org> References: <20190520101206.GA9291@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 20, 2019 at 10:16:57AM -0400, Alan Stern wrote: > What if the allocation requires the kernel to swap some old pages out > to the backing store, but the backing store is on the device that the > driver is managing? The swap can't take place until the current I/O > operation is complete (assuming the driver can handle only one I/O > operation at a time), and the current operation can't complete until > the old pages are swapped out. Result: deadlock. > > Isn't that the whole reason for using GFP_NOIO in the first place? It is, or rather was. As it has been incredibly painful to wire up the gfp_t argument through some callstacks, most notably the vmalloc allocator which is used by a lot of the DMA allocators on non-coherent platforms, we now have the memalloc_noio_save and memalloc_nofs_save functions that mark a thread as not beeing to go into I/O / FS reclaim. So even if you use GFP_KERNEL you will not dip into reclaim with those flags set on the thread.