From: gao xu <gaoxu2@honor.com>
To: "sumit.semwal@linaro.org" <sumit.semwal@linaro.org>
Cc: "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>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linaro-mm-sig@lists.linaro.org" <linaro-mm-sig@lists.linaro.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Barry Song" <21cnbao@gmail.com>,
"surenb@google.com" <surenb@google.com>,
zhouxiaolong <zhouxiaolong9@honor.com>
Subject: [RFC] dma-buf: system_heap: add PTE_CONT for larger contiguous
Date: Mon, 8 Dec 2025 09:41:27 +0000 [thread overview]
Message-ID: <3da6a916cd6d489690b05d2bd64a2b3a@honor.com> (raw)
commit 04c7adb5871a ("dma-buf: system_heap: use larger contiguous mappings
instead of per-page mmap") facilitates the use of PTE_CONT. The system_heap
allocates pages of order 4 and 8 that meet the alignment requirements for
PTE_CONT. enabling PTE_CONT for larger contiguous mappings.
After applying this patch, TLB misses are reduced by approximately 5% when
opening the camera on Android systems.
Signed-off-by: gao xu <gaoxu2@honor.com>
---
drivers/dma-buf/heaps/system_heap.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c
index 4c782fe33..103b06f89 100644
--- a/drivers/dma-buf/heaps/system_heap.c
+++ b/drivers/dma-buf/heaps/system_heap.c
@@ -202,12 +202,16 @@ static int system_heap_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
unsigned long n = (sg->length >> PAGE_SHIFT) - pgoff;
struct page *page = sg_page(sg) + pgoff;
unsigned long size = n << PAGE_SHIFT;
+ pgprot_t prot = vma->vm_page_prot;
if (addr + size > vma->vm_end)
size = vma->vm_end - addr;
+ if (((addr | size) & ~CONT_PTE_MASK) == 0)
+ prot = __pgprot(pgprot_val(prot) | PTE_CONT);
+
ret = remap_pfn_range(vma, addr, page_to_pfn(page),
- size, vma->vm_page_prot);
+ size, prot);
if (ret)
return ret;
--
2.42.0
next reply other threads:[~2025-12-08 9:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-08 9:41 gao xu [this message]
2025-12-08 9:52 ` Barry Song
2025-12-08 10:37 ` Ryan Roberts
2025-12-09 11:37 ` Barry Song
2025-12-09 12:24 ` Ryan Roberts
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=3da6a916cd6d489690b05d2bd64a2b3a@honor.com \
--to=gaoxu2@honor.com \
--cc=21cnbao@gmail.com \
--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-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=surenb@google.com \
--cc=tjmercier@google.com \
--cc=zhouxiaolong9@honor.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
all inboxes | Powered by JetHome®