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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A4DD9FCC9DB for ; Tue, 10 Mar 2026 08:53:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1049C10E698; Tue, 10 Mar 2026 08:53:21 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="YBz3fBCf"; dkim-atps=neutral Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 97B6C10E698 for ; Tue, 10 Mar 2026 08:53:18 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 6B1CB40E41; Tue, 10 Mar 2026 08:53:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 771DDC2BC86; Tue, 10 Mar 2026 08:53:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773132798; bh=79cV/JB6Zd90pNMWKP3NtKHRH1pVizulvRVpEWnwiw8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=YBz3fBCfWY5AuQ9JJ3fdy4ChYCta8JCJbDm0ACVmQJPwGdgDfonDHM0esw92TQ50Y rSb42pG8INyI+DWIq+i98qGvxotT/PBR52MmZUum+DObqJwiWO7e0n3iS1cJXzhc+8 A1BOd4hdrlkzZ+L6LlnSbzjHTrihsTH+2JuvgbwxOQvLPTR/ULqbhW38qEnetklzON 521Hwco+GzkS72S0q+HFC+JgsySttzjiSozpmxv3am958hAqfa2dH3M8X4yINGvZfu Ftd4mckHZk4O4p01h89jTnJI3HSTlCXLuk95BmaVwylElaC8qzEFeWSpjaP1jakVS7 1lXz5OkCeudOw== From: Linus Walleij Date: Tue, 10 Mar 2026 09:53:11 +0100 Subject: [PATCH v2 1/2] dma-buf: heaps: Clear CMA pages with clear_pages() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260310-cma-heap-clear-pages-v2-1-ecbbed3d7e6d@kernel.org> References: <20260310-cma-heap-clear-pages-v2-0-ecbbed3d7e6d@kernel.org> In-Reply-To: <20260310-cma-heap-clear-pages-v2-0-ecbbed3d7e6d@kernel.org> To: Sumit Semwal , Benjamin Gaignard , Brian Starkey , John Stultz , "T.J. Mercier" , =?utf-8?q?Christian_K=C3=B6nig?= Cc: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, Linus Walleij X-Mailer: b4 0.14.3 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As of commit 62a9f5a85b98 "mm: introduce clear_pages() and clear_user_pages()" we can clear a range of pages with a potentially assembly-optimized call. Instead of using a memset, use this helper to clear the whole range of pages from the CMA allocation. Signed-off-by: Linus Walleij --- drivers/dma-buf/heaps/cma_heap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma-buf/heaps/cma_heap.c b/drivers/dma-buf/heaps/cma_heap.c index bd3370b9a3f6..f0bacf25ed9d 100644 --- a/drivers/dma-buf/heaps/cma_heap.c +++ b/drivers/dma-buf/heaps/cma_heap.c @@ -343,7 +343,7 @@ static struct dma_buf *cma_heap_allocate(struct dma_heap *heap, nr_clear_pages--; } } else { - memset(page_address(cma_pages), 0, size); + clear_pages(page_address(cma_pages), pagecount); } buffer->pages = kmalloc_objs(*buffer->pages, pagecount); -- 2.53.0