public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Linus Walleij <linusw@kernel.org>
To: Sumit Semwal <sumit.semwal@linaro.org>,
	Benjamin Gaignard <benjamin.gaignard@collabora.com>,
	Brian Starkey <Brian.Starkey@arm.com>,
	John Stultz <jstultz@google.com>,
	"T.J. Mercier" <tjmercier@google.com>,
	Christian König <christian.koenig@amd.com>
Cc: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org, Linus Walleij <linusw@kernel.org>
Subject: [PATCH v2 1/2] dma-buf: heaps: Clear CMA pages with clear_pages()
Date: Tue, 10 Mar 2026 09:53:11 +0100	[thread overview]
Message-ID: <20260310-cma-heap-clear-pages-v2-1-ecbbed3d7e6d@kernel.org> (raw)
In-Reply-To: <20260310-cma-heap-clear-pages-v2-0-ecbbed3d7e6d@kernel.org>

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 <linusw@kernel.org>
---
 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


  reply	other threads:[~2026-03-10  8:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10  8:53 [PATCH v2 0/2] dma-buf: heaps: Use page clearing helpers Linus Walleij
2026-03-10  8:53 ` Linus Walleij [this message]
2026-03-10 15:29   ` [PATCH v2 1/2] dma-buf: heaps: Clear CMA pages with clear_pages() T.J. Mercier
2026-03-11  3:29   ` Claude review: " Claude Code Review Bot
2026-03-10  8:53 ` [PATCH v2 2/2] dma-buf: heaps: Clear CMA highages using helper Linus Walleij
2026-03-10  8:55   ` Christian König
2026-03-10 15:29   ` T.J. Mercier
2026-03-11  3:29   ` Claude review: " Claude Code Review Bot
2026-03-10 14:30 ` [PATCH v2 0/2] dma-buf: heaps: Use page clearing helpers Maxime Ripard
2026-03-11  3:29 ` Claude review: " Claude Code Review Bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260310-cma-heap-clear-pages-v2-1-ecbbed3d7e6d@kernel.org \
    --to=linusw@kernel.org \
    --cc=Brian.Starkey@arm.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jstultz@google.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-media@vger.kernel.org \
    --cc=sumit.semwal@linaro.org \
    --cc=tjmercier@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox