From patchwork Mon Nov 12 15:42:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Battersby X-Patchwork-Id: 10678861 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F103B14E2 for ; Mon, 12 Nov 2018 15:42:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFBC12A074 for ; Mon, 12 Nov 2018 15:42:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD8A22A0AE; Mon, 12 Nov 2018 15:42:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64E462A074 for ; Mon, 12 Nov 2018 15:42:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6BFB66B0294; Mon, 12 Nov 2018 10:42:16 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 66D086B0296; Mon, 12 Nov 2018 10:42:16 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 55EDE6B0297; Mon, 12 Nov 2018 10:42:16 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by kanga.kvack.org (Postfix) with ESMTP id 228F66B0294 for ; Mon, 12 Nov 2018 10:42:16 -0500 (EST) Received: by mail-qk1-f198.google.com with SMTP id f22so24028094qkm.11 for ; Mon, 12 Nov 2018 07:42:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:subject :to:cc:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=ZAOGdbB9f7ejNhWfDnLeWaCFbXBV/H1CoaxWk7lHKuc=; b=JzGwK1Vp665GOSxE9bGhYB7iZLPWKy65qwxeiYAgO9UojR3M0I538Ra++Du7AkoBuO jjnOUteU/hYnvh0vNchJM2L5MDNvhiFP4ZEKLll+B2pKYjsiSgxzDQ0p46A/wkkTvT+q XwGjwxLbzvFrUZ9qrujpmqU+C9yMJTQJ63xcZNySHJx2iE4lhtnHZ4w2vEc1QrfymseW lCyA43g0aYkSuF7SnBIMWimzRoNFLoa0gdmgpbp3qzqV/q03Ov57DM6CzE1Nhouv6U8o 7L+53BCgOsRB5e6WXIeB93ACsMcd7OaeXLGJC8hO0tBXIIUksfZ4hUIIZt/4TLGAXr1R +4+Q== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of btv1==854ac0a7dab==tonyb@cybernetics.com designates 173.71.130.66 as permitted sender) smtp.mailfrom="btv1==854ac0a7dab==tonyb@cybernetics.com" X-Gm-Message-State: AGRZ1gKJHgi5eCN9CXIAy6IuIUjVbgLXc1ea2WmI6hvu95Ujq734rCdZ It1RPvj4xPIaEdbsLyAoGPNPzVd0yBd6NwJcAKFg8v/zsC5j7P//1tGOs8oJXggkntvEx7vfM+c hJflDv4h3GjsHuwvBM+6z+2LuNfigq/UiAGJAkbNOq9YyIenVqk2Mg+92UiRoka4zdw== X-Received: by 2002:a0c:91e8:: with SMTP id r37mr1405509qvr.141.1542037335803; Mon, 12 Nov 2018 07:42:15 -0800 (PST) X-Google-Smtp-Source: AJdET5eJfVbOjP7zaiLCw5VCiRw+TUQEVW7soZxR+b6PUcTc6E16QmhnWV7nPAH9b6S9qw/1rEqc X-Received: by 2002:a0c:91e8:: with SMTP id r37mr1405472qvr.141.1542037335024; Mon, 12 Nov 2018 07:42:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542037334; cv=none; d=google.com; s=arc-20160816; b=rS+8Qy+xMaLLN7uzqI14OJSgoHlDtLbq9rfh8FlTLN6NrxSpGo84O/FNNoB4nkCxzO 7XBGWRLM7/S/Iiimu297lo8Ew5QpVAuRNU4v4rU3rY4gzcqUgt39NPvsQmwY1VzaqZKT pxx1MYnVv7ZOw51WoGoq7qA/I4ZjBn1+rIl5W4du13n8rfV9cayTjeNsRUrJoO1yOPpt kd3aQPHwabJdckn9jjj752wsY5mx10XKPCAOj2pCTTtQYZ/4o5J0oc3eyY/jSyKtgiw2 aLVrHrT6DZ5YhBpUIL2qoUl6gIJEZw855ys5LAHivs8opLYS8X+zxf0G1uovYxJVF5/j PZQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-language:content-transfer-encoding:mime-version:user-agent :date:message-id:cc:to:subject:from; bh=ZAOGdbB9f7ejNhWfDnLeWaCFbXBV/H1CoaxWk7lHKuc=; b=bzRm37muU3L5DXYpd5s3OVBYeBtZYBje/ZvHuUj/dzd/gidmAzuJUHxAyBWlbl9DZX 2H7hGq74qKeAzZ0tqGl2gnDjOcV7k7cD0AW+p6l3M3WrpHdr/NfPUueRdAkcP9tL0NPd m/KV4wFu2W0OeBha1ZWu3ZrgnjYA21BfgZGdr+IeMSyawOxFAu0189E2N+bK38z8a9il nwdgf+pjChIXEcVzdAGjL2/MmQSsd1smItaYphjwqnd4R9iZlmGsXjCcX6JN5z3j6ch7 tOpj9J0Pu4WevkcTT3Vx/ABrut96jIcUEU7jA1o1mXUihZDYQ1UcrC7/dyne4pgyAMKq nEEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of btv1==854ac0a7dab==tonyb@cybernetics.com designates 173.71.130.66 as permitted sender) smtp.mailfrom="btv1==854ac0a7dab==tonyb@cybernetics.com" Received: from mail.cybernetics.com (mail.cybernetics.com. [173.71.130.66]) by mx.google.com with ESMTPS id y80si12964580qkg.186.2018.11.12.07.42.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 07:42:14 -0800 (PST) Received-SPF: pass (google.com: domain of btv1==854ac0a7dab==tonyb@cybernetics.com designates 173.71.130.66 as permitted sender) client-ip=173.71.130.66; Authentication-Results: mx.google.com; spf=pass (google.com: domain of btv1==854ac0a7dab==tonyb@cybernetics.com designates 173.71.130.66 as permitted sender) smtp.mailfrom="btv1==854ac0a7dab==tonyb@cybernetics.com" X-ASG-Debug-ID: 1542037332-0fb3b01fb3add4f0001-v9ZeMO Received: from cybernetics.com ([10.157.1.126]) by mail.cybernetics.com with ESMTP id LqfhyaLirQDmIW9f (version=SSLv3 cipher=DES-CBC3-SHA bits=112 verify=NO); Mon, 12 Nov 2018 10:42:13 -0500 (EST) X-Barracuda-Envelope-From: tonyb@cybernetics.com X-ASG-Whitelist: Client Received: from [10.157.2.224] (account tonyb HELO [192.168.200.1]) by cybernetics.com (CommuniGate Pro SMTP 5.1.14) with ESMTPSA id 8529340; Mon, 12 Nov 2018 10:42:12 -0500 From: Tony Battersby Subject: [PATCH v4 2/9] dmapool: remove checks for dev == NULL To: Matthew Wilcox , Christoph Hellwig , Marek Szyprowski , iommu@lists.linux-foundation.org, linux-mm@kvack.org X-ASG-Orig-Subj: [PATCH v4 2/9] dmapool: remove checks for dev == NULL Cc: "linux-scsi@vger.kernel.org" Message-ID: Date: Mon, 12 Nov 2018 10:42:12 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 Content-Language: en-US X-Barracuda-Connect: UNKNOWN[10.157.1.126] X-Barracuda-Start-Time: 1542037333 X-Barracuda-Encrypted: DES-CBC3-SHA X-Barracuda-URL: https://10.157.1.122:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 3468 X-Virus-Scanned: by bsmtpd at cybernetics.com X-Barracuda-BRTS-Status: 1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP dmapool originally tried to support pools without a device because dma_alloc_coherent() supports allocations without a device. But nobody ended up using dma pools without a device, so the current checks in dmapool.c for pool->dev == NULL are both insufficient and causing bloat. Remove them. Signed-off-by: Tony Battersby Acked-by: Matthew Wilcox --- linux/mm/dmapool.c.orig 2018-08-03 16:12:23.000000000 -0400 +++ linux/mm/dmapool.c 2018-08-03 16:13:44.000000000 -0400 @@ -277,7 +277,7 @@ void dma_pool_destroy(struct dma_pool *p mutex_lock(&pools_reg_lock); mutex_lock(&pools_lock); list_del(&pool->pools); - if (pool->dev && list_empty(&pool->dev->dma_pools)) + if (list_empty(&pool->dev->dma_pools)) empty = true; mutex_unlock(&pools_lock); if (empty) @@ -289,13 +289,9 @@ void dma_pool_destroy(struct dma_pool *p page = list_entry(pool->page_list.next, struct dma_page, page_list); if (is_page_busy(page)) { - if (pool->dev) - dev_err(pool->dev, - "dma_pool_destroy %s, %p busy\n", - pool->name, page->vaddr); - else - pr_err("dma_pool_destroy %s, %p busy\n", - pool->name, page->vaddr); + dev_err(pool->dev, + "dma_pool_destroy %s, %p busy\n", + pool->name, page->vaddr); /* leak the still-in-use consistent memory */ list_del(&page->page_list); kfree(page); @@ -357,13 +353,9 @@ void *dma_pool_alloc(struct dma_pool *po for (i = sizeof(page->offset); i < pool->size; i++) { if (data[i] == POOL_POISON_FREED) continue; - if (pool->dev) - dev_err(pool->dev, - "dma_pool_alloc %s, %p (corrupted)\n", - pool->name, retval); - else - pr_err("dma_pool_alloc %s, %p (corrupted)\n", - pool->name, retval); + dev_err(pool->dev, + "dma_pool_alloc %s, %p (corrupted)\n", + pool->name, retval); /* * Dump the first 4 bytes even if they are not @@ -418,13 +410,9 @@ void dma_pool_free(struct dma_pool *pool page = pool_find_page(pool, dma); if (!page) { spin_unlock_irqrestore(&pool->lock, flags); - if (pool->dev) - dev_err(pool->dev, - "dma_pool_free %s, %p/%lx (bad dma)\n", - pool->name, vaddr, (unsigned long)dma); - else - pr_err("dma_pool_free %s, %p/%lx (bad dma)\n", - pool->name, vaddr, (unsigned long)dma); + dev_err(pool->dev, + "dma_pool_free %s, %p/%lx (bad dma)\n", + pool->name, vaddr, (unsigned long)dma); return; } @@ -432,13 +420,9 @@ void dma_pool_free(struct dma_pool *pool #ifdef DMAPOOL_DEBUG if ((dma - page->dma) != offset) { spin_unlock_irqrestore(&pool->lock, flags); - if (pool->dev) - dev_err(pool->dev, - "dma_pool_free %s, %p (bad vaddr)/%pad\n", - pool->name, vaddr, &dma); - else - pr_err("dma_pool_free %s, %p (bad vaddr)/%pad\n", - pool->name, vaddr, &dma); + dev_err(pool->dev, + "dma_pool_free %s, %p (bad vaddr)/%pad\n", + pool->name, vaddr, &dma); return; } { @@ -449,12 +433,9 @@ void dma_pool_free(struct dma_pool *pool continue; } spin_unlock_irqrestore(&pool->lock, flags); - if (pool->dev) - dev_err(pool->dev, "dma_pool_free %s, dma %pad already free\n", - pool->name, &dma); - else - pr_err("dma_pool_free %s, dma %pad already free\n", - pool->name, &dma); + dev_err(pool->dev, + "dma_pool_free %s, dma %pad already free\n", + pool->name, &dma); return; } }