Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2095074yba; Fri, 17 May 2019 10:19:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6uXIuSj2zZoEPC9PMNkJBXYCndPA9ndjE2+99nsRST+Ep3Cc/8r1Fud5iTsNXuaU6LcwH X-Received: by 2002:aa7:9a1d:: with SMTP id w29mr40859496pfj.81.1558113565440; Fri, 17 May 2019 10:19:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558113565; cv=none; d=google.com; s=arc-20160816; b=BjvgOCQM3H72CGYVvHbPcQ3QtIIItiSNPKF909egVSEz9QdPe8YMGDPHNTBrLpLNn+ xNr3GGFYIdkGsL/aNOerc6babC2uK+LkCTE2xHEuJS7ft0asPAysNlpWuCeFt2bqthUB SKskCy/xNL05OTwcpfVvnm/easUTJKfrrcYcrobbIHtENsDU2/MbRksFfIpf+PKs61d4 60nbsNd3Vx9v7aLjJ7nDOr8Mjn5eZWSSArgr3msk81xirLAOj11HkKNRtpBm+R0jRvKf 9+g+DkYfEgWjza/aDDTLukCu7tOt+Cc1oVKUQOW7xvW4IWIqD5ZCDyxrm1jQvw2ycJ/E qyAA== 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=Gfmhm1QndU1vd1KEmZzYh+ZiMXcMk0B49UsIQYdD2dY=; b=J5b9CTRrjZKlibjnaWZd4Tlo6tCyUuoUhJmAenu5egZa+vODIGn1KT6fZqxPUG6HUi 7oqBzLnZ6FDy3Yv5/AuAWl3SB0XOlRyzj4TvS3/17bKJCykiaqp3bmHUWE9qTO9TswyW Orp82FYmAhO1psHkVZ1IA+Fi9aLp1c0NoZ79flBP+uVT6C84hXa0KZE9FbO5CUauoFgc AaHME8XWSkPVumsefTKYl8czy7VavQW8xgmKv+WnWo/CZ1ZG+aKHVRAv/nASQCW6AsS4 dq4GU2hR8PPK46mlFaXfFDxwWvRd7p6qZ6WEX6ZonW73YVLgBjSXSBhHDvy/nQ5wuYXy MnMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=oncT9ByR; 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 24si8517385pgt.474.2019.05.17.10.19.10; Fri, 17 May 2019 10:19:25 -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=oncT9ByR; 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 S1726761AbfEQQeW (ORCPT + 99 others); Fri, 17 May 2019 12:34:22 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:57476 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725932AbfEQQeW (ORCPT ); Fri, 17 May 2019 12:34:22 -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=Gfmhm1QndU1vd1KEmZzYh+ZiMXcMk0B49UsIQYdD2dY=; b=oncT9ByRFsu0LIodjLvi9FTXl B/LOhGID0QvmlZPRC5j2ltiGoiPdmoOFyFLY1k/V3UaaLked3INDzOiNZmLdkTHFvtvHmo4iLSSpj y1hqmUexfR8Qhk9mNHA+EMLMcS9HqKL5fhpZIvbNrCYJxOtPXfJt1aFxJkDlD6OLngDMoXVoh+VFQ GTsJ3fHQ0lx76k6yEztxe0DGZ6CVIVq4AA8jVgmVrVXMPDfuJxIt4227EKDZrwDNye969GcP3PC5W 0sh5QzdtGZNC1dqNYRhwmJY4EUlsTVkaH7ZoEKyqb2FPxcDcqGZGGBZa7fkS/9sIQomHVg+gIWV8/ GxFHUoq5Q==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1hRfoK-0002UT-DP; Fri, 17 May 2019 16:34:20 +0000 Date: Fri, 17 May 2019 09:34:20 -0700 From: Matthew Wilcox To: Jaewon Kim Cc: gregkh@linuxfoundation.org, m.szyprowski@samsung.com, linux-mm@kvack.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Jaewon Kim , ytk.lee@samsung.com Subject: Re: [RFC PATCH] usb: host: xhci: allow __GFP_FS in dma allocation Message-ID: <20190517163420.GG31704@bombadil.infradead.org> References: 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 18, 2019 at 01:02:28AM +0900, Jaewon Kim wrote: > Hello I don't have enough knowledge on USB core but I've wondered > why GFP_NOIO has been used in xhci_alloc_dev for > xhci_alloc_virt_device. I found commit ("a6d940dd759b xhci: Use > GFP_NOIO during device reset"). But can we just change GFP_NOIO > to __GFP_RECLAIM | __GFP_FS ? No. __GFP_FS implies __GFP_IO; you can't set __GFP_FS and clear __GFP_IO. It seems like the problem you have is using the CMA to do DMA allocation. Why would you do such a thing? > Please refer to below case. > > I got a report from Lee YongTaek that the > xhci_alloc_virt_device was too slow over 2 seconds only for one page > allocation. > > 1) It was because kernel version was v4.14 and DMA allocation was > done from CMA(Contiguous Memory Allocator) where CMA region was > almost filled with file page and CMA passes GFP down to page > isolation. And the page isolation only allows file page isolation only to > requests having __GFP_FS. > > 2) Historically CMA was changed at v4.19 to use GFP_KERNEL > regardless of GFP passed to DMA allocation through the > commit 6518202970c1 "(mm/cma: remove unsupported gfp_mask > parameter from cma_alloc()". > > I think pre v4.19 the xhci_alloc_virt_device could be very slow > depending on CMA situation but free to USB deadlock issue. But as of > v4.19, I think, it will be fast but can face the deadlock issue. > Consequently I think to meet the both cases, I think USB can pass > __GFP_FS without __GFP_IO. > > If __GFP_FS is passed from USB core, of course, the CMA patch also > need to be changed to pass GFP.