From patchwork Tue Jan 22 18:13:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 14213 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 455D623E02 for ; Tue, 22 Jan 2013 18:15:04 +0000 (UTC) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by fiordland.canonical.com (Postfix) with ESMTP id DE609A18F69 for ; Tue, 22 Jan 2013 18:15:03 +0000 (UTC) Received: by mail-ve0-f178.google.com with SMTP id oz10so650142veb.9 for ; Tue, 22 Jan 2013 10:15:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:from:to:date:user-agent:references:in-reply-to :mime-version:message-id:x-provags-id:cc:subject:x-beenthere :x-mailman-version:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:content-type :content-transfer-encoding:sender:errors-to:x-gm-message-state; bh=CHu64rzMC0i3sivFtL96cK8O7MOkovg5G5/3ket7SOQ=; b=EgXOwbR6wsuABl5THZC4PObEKiJYPY7rL0hn9hfVuyhHLI/cZ0XCZRsSYFZMga7gWY uehu9lrc5qCWXxhCt23xOHMVoLHwqb6H9V2fSfXtVxF71/SOkbc6vT9IN9Yq/t+LVOvs Wg9LXJ1p2TH8+ZoYOEq3e8Z5Hhx8D/ldzD1zgLgtXs5rYyWSyJAN79BGpNwtq4ZPJhBq VBA//bDVOBc2BNGnhPiPeNo92fIFz4mu0ILsHrGUYDtwh30oF+44yCnK/knB9zBOt1jb A53TvCCMm6WS/xyU0tynInDB5U+rhY4diyZqYWJ1bMzyMkqaiWTYp4Bpo2jJc5A2QVAB ukXQ== X-Received: by 10.220.39.69 with SMTP id f5mr19795933vce.45.1358878503284; Tue, 22 Jan 2013 10:15:03 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp264756veb; Tue, 22 Jan 2013 10:15:01 -0800 (PST) X-Received: by 10.14.3.137 with SMTP id 9mr63831749eeh.2.1358878500174; Tue, 22 Jan 2013 10:15:00 -0800 (PST) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id l4si12586755eeo.218.2013.01.22.10.14.59; Tue, 22 Jan 2013 10:15:00 -0800 (PST) Received-SPF: neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) client-ip=91.189.95.16; Authentication-Results: mx.google.com; spf=neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) smtp.mail=linaro-mm-sig-bounces@lists.linaro.org Received: from localhost ([127.0.0.1] helo=mombin.canonical.com) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TxiN2-0006E9-W5; Tue, 22 Jan 2013 18:14:53 +0000 Received: from moutng.kundenserver.de ([212.227.126.187]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TxiN2-0006E3-1J for linaro-mm-sig@lists.linaro.org; Tue, 22 Jan 2013 18:14:52 +0000 Received: from klappe2.localnet (HSI-KBW-46-223-90-92.hsi.kabel-badenwuerttemberg.de [46.223.90.92]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0M2Yvh-1T5smk0bkD-00ruZi; Tue, 22 Jan 2013 19:14:03 +0100 From: Arnd Bergmann To: Greg KH Date: Tue, 22 Jan 2013 18:13:57 +0000 User-Agent: KMail/1.12.2 (Linux/3.7.0-7-generic; KDE/4.3.2; x86_64; ; ) References: <20121119144826.f59667b2.akpm@linux-foundation.org> <201301211855.25455.arnd@arndb.de> <20130121210150.GA9184@kroah.com> In-Reply-To: <20130121210150.GA9184@kroah.com> MIME-Version: 1.0 Message-Id: <201301221813.57741.arnd@arndb.de> X-Provags-ID: V02:K0:LZBaiUurf/9ndAqAk9+J2+DeW5NLjUr4pycdEKBHqwC 5GCMLLc9KYpo5953RiGWc2U04BU45PYoVrfDp1XPDlDhYt7gPy hyv4BRCoTGqRdsy9giBX1+jT76ZfyqbKR5np53iaPXwPlzt8eG TOKniVpTtruzLK8DUhBDJomqjmaWEzM+zbQnJCqTMmi2fNFEm5 AIdFFwjD2udIL3gpa1XbUwBTayP9fWq/PoqSojz0x5i4c5emgV cwC8Ok4PUphYIZPP4uXIkEdOmatzweZ7b51jzfZWq3otGnJTx8 KXdjNeXnM5AlkukXxRqG8ZJAFs6yHsm8tYKX+6OmLvGeb2KzSd ShEi4xE6Nngt6wqxnkfs= Cc: Thomas Petazzoni , Andrew Lunn , Jason Cooper , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Michal Hocko , linux-mm@kvack.org, Kyungmin Park , Soeren Moch , Mel Gorman , Andrew Morton , Sebastian Hesselbarth , linaro-mm-sig@lists.linaro.org, KAMEZAWA Hiroyuki Subject: Re: [Linaro-mm-sig] [PATCH v2] mm: dmapool: use provided gfp flags for all dma_alloc_coherent() calls X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Unified memory management interest group." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQmH+d/a3E4Rg2hchmQPtvVwcHQ5UBqCudX2kG6XlbqcnpLwJd6lRcDSSUgR4zyeOldlOLbc On Monday 21 January 2013, Greg KH wrote: > > > > I don't know a lot about USB, but I always assumed that this was not > > a normal condition and that there are only a couple of URBs per endpoint > > used at a time. Maybe Greg or someone else with a USB background can > > shed some light on this. > > There's no restriction on how many URBs a driver can have outstanding at > once, and if you have a system with a lot of USB devices running at the > same time, there could be lots of URBs in flight depending on the number > of host controllers and devices and drivers being used. Ok, thanks for clarifying that. I read some more of the em28xx driver, and while it does have a bunch of URBs in flight, there are only five audio and five video URBs that I see simultaneously being submitted, and then resubmitted from their completion handlers. I think this means that there should be 10 URBs active at any given time in this driver, which does not explain why we get 256 allocations. I also noticed that the initial submissions are all atomic but don't need to, so it may be worth trying the patch below, which should also help in low-memory situations. We could also try moving the resubmission into a workqueue in order to let those be GFP_KERNEL, but I don't think that will help. Arnd diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c index 2fdb66e..8b789f4 100644 --- a/drivers/media/usb/em28xx/em28xx-audio.c +++ b/drivers/media/usb/em28xx/em28xx-audio.c @@ -177,12 +177,12 @@ static int em28xx_init_audio_isoc(struct em28xx *dev) struct urb *urb; int j, k; - dev->adev.transfer_buffer[i] = kmalloc(sb_size, GFP_ATOMIC); + dev->adev.transfer_buffer[i] = kmalloc(sb_size, GFP_KERNEL); if (!dev->adev.transfer_buffer[i]) return -ENOMEM; memset(dev->adev.transfer_buffer[i], 0x80, sb_size); - urb = usb_alloc_urb(EM28XX_NUM_AUDIO_PACKETS, GFP_ATOMIC); + urb = usb_alloc_urb(EM28XX_NUM_AUDIO_PACKETS, GFP_KERNEL); if (!urb) { em28xx_errdev("usb_alloc_urb failed!\n"); for (j = 0; j < i; j++) { @@ -212,7 +212,7 @@ static int em28xx_init_audio_isoc(struct em28xx *dev) } for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { - errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC); + errCode = usb_submit_urb(dev->adev.urb[i], GFP_KERNEL); if (errCode) { em28xx_errdev("submit of audio urb failed\n"); em28xx_deinit_isoc_audio(dev); diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c index bed07a6..c5a2c4b 100644 --- a/drivers/media/usb/em28xx/em28xx-core.c +++ b/drivers/media/usb/em28xx/em28xx-core.c @@ -1166,7 +1166,7 @@ int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode, /* submit urbs and enables IRQ */ for (i = 0; i < isoc_bufs->num_bufs; i++) { - rc = usb_submit_urb(isoc_bufs->urb[i], GFP_ATOMIC); + rc = usb_submit_urb(isoc_bufs->urb[i], GFP_KERNEL); if (rc) { em28xx_err("submit of urb %i failed (error=%i)\n", i, rc);