From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 761CDC7EE2F for ; Sun, 26 Feb 2023 23:49:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229568AbjBZXtH (ORCPT ); Sun, 26 Feb 2023 18:49:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbjBZXtA (ORCPT ); Sun, 26 Feb 2023 18:49:00 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 358849038 for ; Sun, 26 Feb 2023 15:48:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D8F6EB80C9E for ; Sun, 26 Feb 2023 23:48:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72A51C433EF; Sun, 26 Feb 2023 23:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1677455329; bh=uPcL7/JC6HYbdF+vjWReMthhpSYTMaFFkaqPy/VXXWo=; h=Date:To:From:Subject:From; b=CTGotsrcXiAcXIElcAX2zTBrMGHsjkYzV9nd8rSa4vi2wSTGWynX36FsDE4WO9k8v 6HRaIqdZGzNlK5Pz73wjaUnZiurjeHu3Pr2wweijZonjUhkZ2sNtHXoybM7S6tm+jH Qb/q/uiOwgDibwOgZNtxtneZq2NYBZqe4FfK0sxI= Date: Sun, 26 Feb 2023 15:48:48 -0800 To: mm-commits@vger.kernel.org, willy@infradead.org, tonyb@cybernetics.com, hch@lst.de, kbusch@kernel.org, akpm@linux-foundation.org From: Andrew Morton Subject: [merged mm-stable] dmapool-simplify-freeing.patch removed from -mm tree Message-Id: <20230226234849.72A51C433EF@smtp.kernel.org> Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The quilt patch titled Subject: dmapool: simplify freeing has been removed from the -mm tree. Its filename was dmapool-simplify-freeing.patch This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm ------------------------------------------------------ From: Keith Busch Subject: dmapool: simplify freeing Date: Thu, 26 Jan 2023 13:51:22 -0800 The actions for busy and not busy are mostly the same, so combine these and remove the unnecessary function. Also, the pool is about to be freed so there's no need to poison the page data since we only check for poison on alloc, which can't be done on a freed pool. Link: https://lkml.kernel.org/r/20230126215125.4069751-10-kbusch@meta.com Signed-off-by: Keith Busch Reviewed-by: Christoph Hellwig Cc: Matthew Wilcox Cc: Tony Battersby Signed-off-by: Andrew Morton --- --- a/mm/dmapool.c~dmapool-simplify-freeing +++ a/mm/dmapool.c @@ -312,16 +312,6 @@ static inline bool is_page_busy(struct d return page->in_use != 0; } -static void pool_free_page(struct dma_pool *pool, struct dma_page *page) -{ - dma_addr_t dma = page->dma; - - pool_init_page(pool, page); - dma_free_coherent(pool->dev, pool->allocation, page->vaddr, dma); - list_del(&page->page_list); - kfree(page); -} - /** * dma_pool_destroy - destroys a pool of dma memory blocks. * @pool: dma pool that will be destroyed @@ -349,14 +339,14 @@ void dma_pool_destroy(struct dma_pool *p mutex_unlock(&pools_reg_lock); list_for_each_entry_safe(page, tmp, &pool->page_list, page_list) { - if (is_page_busy(page)) { + if (!is_page_busy(page)) + dma_free_coherent(pool->dev, pool->allocation, + page->vaddr, page->dma); + else dev_err(pool->dev, "%s %s, %p busy\n", __func__, pool->name, page->vaddr); - /* leak the still-in-use consistent memory */ - list_del(&page->page_list); - kfree(page); - } else - pool_free_page(pool, page); + list_del(&page->page_list); + kfree(page); } kfree(pool); _ Patches currently in -mm which might be from kbusch@kernel.org are