Before invoke vmap, we need offer a pages pointer array which each page
need to map in vmalloc area.
But currently vmap_udmabuf only set each folio's head page into pages,
missed each offset pages when iter.
This patch set the correctly offset page in each folio into array.
Signed-off-by:
with pages/folios backed by shmem/hugetlbfs/THP, vmap_pfn()
is not the right tool or API to invoke for implementing vmap.
Signed-off-by: Huan Yang
Suggested-by: Kasireddy, Vivek
Reported-by: Bingbu Cao
Closes:
https://lore.kernel.org/dri-devel/eb7e0137-3508-4287-98c4-816c5fd98...@vivo.com/T
ore.kernel.org/all/9172a601-c360-0d5b-ba1b-33deba430...@linux.intel.com/
[2] https://lore.kernel.org/all/20250312061513.1126496-1-l...@vivo.com/
[3] https://lore.kernel.org/all/20250327092922.536-1-l...@vivo.com/
Huan Yang (2):
Revert "udmabuf: fix vmap_udmabuf error page set"
udmabuf:
在 2025/4/28 12:16, Kasireddy, Vivek 写道:
Hi Huan,
Subject: Re: [PATCH 1/2] Revert "udmabuf: fix vmap_udmabuf error page set"
From 38aa11d92f209e7529736f3e11e08dfc804bdfae Mon Sep 17 00:00:00
2001
From: Huan Yang
Date: Tue, 15 Apr 2025 10:04:18 +0800
Subject: [PATCH 1/2] Rever
From 38aa11d92f209e7529736f3e11e08dfc804bdfae Mon Sep 17 00:00:00 2001
From: Huan Yang
Date: Tue, 15 Apr 2025 10:04:18 +0800
Subject: [PATCH 1/2] Revert "udmabuf: fix vmap_udmabuf error page set"
This reverts commit 18d7de823b7150344d242c3677e65d68c5271b04.
This given a misuse o
pages,
missed each offset pages when iter.
This patch set the correctly offset page in each folio into array.
Signed-off-by: Huan Yang
Fixes: 5e72b2b41a21 ("udmabuf: convert udmabuf driver to use folios")
---
drivers/dma-buf/udmabuf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-
based
user invoke, i.e. PCIe BARs and other.
The commit message can be improved a little bit to briefly explain why
vmap_pfn()
would not work for this use-case.
OK, I will update patch direct in later reply.:)
Thanks,
Huan
Acked-by: Vivek Kasireddy
Thanks,
Vivek
Signed-off-by: Huan Yang
R
This reverts commit 18d7de823b7150344d242c3677e65d68c5271b04.
This given a misuse of vmap_pfn, vmap_pfn only allow none-page based
user invoke, i.e. PCIe BARs and other.
Signed-off-by: Huan Yang
Reported-by: Bingbu Cao
Closes:
https://lore.kernel.org/dri-devel/eb7e0137-3508-4287-98c4
[3] https://lore.kernel.org/all/20250327092922.536-1-l...@vivo.com/
Huan Yang (2):
Revert "udmabuf: fix vmap_udmabuf error page set"
udmabuf: fix vmap missed offset page
drivers/dma-buf/Kconfig | 1 -
drivers/dma-buf/udmabuf.c | 23 ---
2 files changed, 8 inserti
Before invoke vmap, we need offer a pages pointer array which each page
need to map in vmalloc area.
But currently vmap_udmabuf only set each folio's head page into pages,
missed each offset pages when iter.
This patch set the correctly offset page in each folio into array.
Signed-off-by:
在 2025/4/7 15:22, Muchun Song 写道:
On Apr 7, 2025, at 15:09, Huan Yang wrote:
在 2025/4/7 14:43, Muchun Song 写道:
On Apr 7, 2025, at 11:37, Muchun Song wrote:
On Apr 7, 2025, at 11:21, Huan Yang wrote:
在 2025/4/7 10:57, Muchun Song 写道:
On Apr 7, 2025, at 09:59, Huan Yang wrote
在 2025/4/7 14:43, Muchun Song 写道:
On Apr 7, 2025, at 11:37, Muchun Song wrote:
On Apr 7, 2025, at 11:21, Huan Yang wrote:
在 2025/4/7 10:57, Muchun Song 写道:
On Apr 7, 2025, at 09:59, Huan Yang wrote:
在 2025/4/4 18:07, Muchun Song 写道:
On Apr 4, 2025, at 17:38, Muchun Song wrote
在 2025/4/7 10:57, Muchun Song 写道:
On Apr 7, 2025, at 09:59, Huan Yang wrote:
在 2025/4/4 18:07, Muchun Song 写道:
On Apr 4, 2025, at 17:38, Muchun Song wrote:
On Apr 4, 2025, at 17:01, Christoph Hellwig wrote:
After the btrfs compressed bio discussion I think the hugetlb changes that
need map page 2-7, can we use vmap do
something correctly?
Or something I still misunderstand, please correct me.
Thanks,
Huan Yang
of the fundamentals of HVO, I kindly suggest a thorough review of the document
in [3].
[2]
https://lore.kernel.org/lkml/5229b24f-1984-4225-ae03-8b952de56...@v
This patch both compare pages and pfns based vmap, to show folios
range vmap and pfn range vmap can work.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 64 ---
1 file changed, 46 insertions(+), 18 deletions(-)
diff --git a/drivers/dma-buf
This patch change udmabuf from use pfn based into folio based vmap.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 25 -
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index fbe4b59b4c97
vmap_pfn design to only allow none page based pfn map.
This patch try simple copy pfn vmap code to fix it.
Fix vunmap_udmabuf fix match with vmap_udmabuf, use vunmap.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 49 +++
1 file changed, 45
pages).
Signed-off-by: Huan Yang
---
include/linux/vmalloc.h | 57 +
mm/vmalloc.c| 47 +
2 files changed, 104 insertions(+)
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 31e9ffd936e3..007a398
This patch remove each test code.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 142 ---
include/uapi/linux/udmabuf.h | 5 -
.../selftests/drivers/dma-buf/Makefile| 1 -
.../selftests/drivers/dma-buf/udmabuf_vmap.c | 166
This patch add a test ioctl in udmabuf to show vmap can work.
by compare pfn vmap and pages vmap.
But this skip HVO folio compare due to can't use pages vmap.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 71
include/uapi/linux/udma
check output, and dmesg if any warn.
[1]
https://lore.kernel.org/all/9172a601-c360-0d5b-ba1b-33deba430...@linux.intel.com/
[2] https://lore.kernel.org/lkml/20250312061513.1126496-1-l...@vivo.com/
[3]
https://lore.kernel.org/linux-mm/20250131001806.92349-1-vishal.mo...@gmail.com/
Huan Yang (6)
在 2025/3/11 19:14, Ryan Roberts 写道:
Hi,
On 11/03/2025 09:34, Huan Yang wrote:
Hi Christoph and Ryan,
Can you help us check vmap_pfn's pfn check is right? Did here mischecked
pfn_valid?
I'm no expert on this piece of code, but I believe pfn_valid() is checking to
see if a pf
Hi Christoph and Ryan,
Can you help us check vmap_pfn's pfn check is right? Did here mischecked
pfn_valid?
Thank you.
在 2025/3/11 17:02, Bingbu Cao 写道:
Christoph and Ryan,
Could you help check this? Thanks.
On 3/11/25 4:54 PM, Huan Yang wrote:
在 2025/3/11 16:42, Bingbu Cao 写道:
在 2025/3/11 16:42, Bingbu Cao 写道:
[You don't often get email from bingbu@linux.intel.com. Learn why this is
important at https://aka.ms/LearnAboutSenderIdentification ]
Huan,
Thanks for your response.
On 3/11/25 3:12 PM, Huan Yang wrote:
在 2025/3/11 14:40, Bingbu Cao 写道:
[You
在 2025/3/11 14:40, Bingbu Cao 写道:
[You don't often get email from bingbu@linux.intel.com. Learn why this is
important at https://aka.ms/LearnAboutSenderIdentification ]
Huan Yang and Vivek,
I am trying to use udmabuf for my test, and I cannot vmap the udmabuf
buffers now. vmap_pfn_
74914-1-l...@vivo.com/
v3
https://lore.kernel.org/all/20240813090518.3252469-1-l...@vivo.com/
v2
https://lore.kernel.org/all/20240805032550.3912454-1-l...@vivo.com/
v1
https://lore.kernel.org/all/20240801104512.4056860-1-l...@vivo.com/
Huan Yang (7):
udmabuf: pre-fault when first pa
if each item's range folio's count is large, we may fallback each
into vmalloc.
This patch find the largest range folio in items, then alloc this size's
folio array. When pin range folios, reuse this array.
Signed-off-by: Huan Yang
Acked-by: Vivek Kasireddy
---
https://lore.kernel.org/all/20240822084342.1574914-1-l...@vivo.com/
v3
https://lore.kernel.org/all/20240813090518.3252469-1-l...@vivo.com/
v2
https://lore.kernel.org/all/20240805032550.3912454-1-l...@vivo.com/
v1
https://lore.kernel.org/all/20240801104512.4056860-1-l...@vivo.com/
Huan Yang (
.
This patch give a helper function when init and deinit, by this,
reduce duplicate code.
Signed-off-by: Huan Yang
Acked-by: Vivek Kasireddy
---
drivers/dma-buf/udmabuf.c | 52 +++
1 file changed, 31 insertions(+), 21 deletions(-)
diff --git a/drivers/dma-buf
, depend on the large folio's number, the
pinned_folios array may take more memory, but it still can makes unpin
access more cache-friendly.
Signed-off-by: Huan Yang
Acked-by: Vivek Kasireddy
---
drivers/dma-buf/udmabuf.c | 65 +--
1 file changed, 29 inser
then record each offset in it.
Compare to iter by pgcnt, more readable.
Suggested-by: Vivek Kasireddy
Signed-off-by: Huan Yang
Acked-by: Vivek Kasireddy
---
drivers/dma-buf/udmabuf.c | 137 +-
1 file changed, 76 insertions(+), 61 deletions(-)
diff --git a
t use page array to map, instead, use pfn array.
By this, we removed page usage in udmabuf totally.
Fixes: 5e72b2b41a21 ("udmabuf: convert udmabuf driver to use folios")
Suggested-by: Vivek Kasireddy
Signed-off-by: Huan Yang
Acked-by: Vivek Kasireddy
---
drivers/dma-buf/Kconfig | 1
truly accessed
Suggested-by: Vivek Kasireddy
Signed-off-by: Huan Yang
Acked-by: Vivek Kasireddy
---
drivers/dma-buf/udmabuf.c | 33 +++--
1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index
cation for any size and does
not affect the performance of kmalloc allocations.
Signed-off-by: Huan Yang
Acked-by: Christian König
Acked-by: Vivek Kasireddy
---
drivers/dma-buf/udmabuf.c | 26 +-
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/d
modifies
the original loop condition, using the pinned folio as the external
loop condition, and sets the offset and folio during the traversal process.
By this, more readable.
Suggested-by: Vivek Kasireddy
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 134
f: convert udmabuf driver to use folios")
OK, I'll update it
Thanks,
Vivek
Suggested-by: Vivek Kasireddy
Signed-off-by: Huan Yang
Acked-by: Vivek Kasireddy
---
drivers/dma-buf/Kconfig | 1 +
drivers/dma-buf/udmabuf.c | 22 +++---
2 files changed, 16 inser
e can iterate through the folios array during release and
unpin any folio that is different from the ones previously accessed.
By this, not only saves the overhead of the udmabuf_folio data structure
but also makes array access more cache-friendly.
Signed-off-by: Huan Yang
Acked-by: Vivek Kasi
size is huge, need fallback into vmalloc, then, not well, due to
each page need alloc, and map into vmalloc area. Too heavy.
Now that we need to iter each udmabuf item, then pin it's range folios,
we can reuse the maximum size range's folios array.
Signed-off-by: Huan Yang
Acked
traversal process.
By this, more readable.
Suggested-by: Vivek Kasireddy
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 134 +-
1 file changed, 76 insertions(+), 58 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
t use page array to map, instead, use pfn array.
By this, we removed page usage in udmabuf totally.
Suggested-by: Vivek Kasireddy
Signed-off-by: Huan Yang
Acked-by: Vivek Kasireddy
---
drivers/dma-buf/Kconfig | 1 +
drivers/dma-buf/udmabuf.c | 22 +++---
2 files changed, 16 ins
cation for any size and does
not affect the performance of kmalloc allocations.
Signed-off-by: Huan Yang
Acked-by: Christian König
Acked-by: Vivek Kasireddy
---
drivers/dma-buf/udmabuf.c | 26 +-
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/d
.
This patch give a helper function when init and deinit, by this,
reduce duplicate code.
Signed-off-by: Huan Yang
Acked-by: Vivek Kasireddy
---
drivers/dma-buf/udmabuf.c | 52 +++
1 file changed, 31 insertions(+), 21 deletions(-)
diff --git a/drivers/dma-buf
truly accessed
Suggested-by: Vivek Kasireddy
Signed-off-by: Huan Yang
Acked-by: Vivek Kasireddy
---
drivers/dma-buf/udmabuf.c | 33 +++--
1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index
ttps://lore.kernel.org/all/20240805032550.3912454-1-l...@vivo.com/
v1
https://lore.kernel.org/all/20240801104512.4056860-1-l...@vivo.com/
Huan Yang (7):
udmabuf: pre-fault when first page fault
udmabuf: change folios array from kmalloc to kvmalloc
udmabuf: fix vmap_udmabuf error page set
udmabuf:
, end of loop.
By this, more readable.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 132 --
1 file changed, 71 insertions(+), 61 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index 456db58446e1..ca2b21c5c57f
, then pin it's range folios,
we can reuse the maximum size range's folios array.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 34 --
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf
cture
but also makes array access more cache-friendly.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 65 +--
1 file changed, 29 insertions(+), 36 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index 254d9ec
correctness
in the commit messages of other patches as well.
I'll fix it in next-version
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 52 +++
1 file changed, 31 insertions(+), 21 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dm
t the first time.
Suggested-by: Vivek Kasireddy
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 35 +--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index 047c3cd2ceff..0a8c231a36e1 1
iterates through folios, while the inner loop correctly
sets the folio and corresponding offset into the udmabuf starting from
the offset. if reach to pgcnt or nr_folios, end of loop.
By this, more readable.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 132
size is huge, need fallback into vmalloc, then, not well, due to
each page will iter alloc, and map into vmalloc area. Too heavy.
Now that we need to iter each udmabuf item, then pin it's range folios,
we can reuse the maximum size range's folios array.
Signed-off-by: Huan Yang
---
d
e can iterate through the folios array during release and
unpin any folio that is different from the ones previously accessed.
By this, not only saves the overhead of the udmabuf_folio data structure
but also makes array access more cache-friendly.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udma
.
This patch give a helper function when init and deinit, by this,
deduce duplicate code.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 52 +++
1 file changed, 31 insertions(+), 21 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf
. if reach to pgcnt or nr_folios, end of loop.
By this, more readable.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 132 --
1 file changed, 71 insertions(+), 61 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index
t use page array to map, instead, use pfn array.
By this, we removed page usage in udmabuf totally.
Suggested-by: Vivek Kasireddy
Signed-off-by: Huan Yang
Acked-by: Vivek Kasireddy
---
drivers/dma-buf/Kconfig | 1 +
drivers/dma-buf/udmabuf.c | 22 +++---
2 files changed, 16 ins
cation for any size and does
not affect the performance of kmalloc allocations.
Signed-off-by: Huan Yang
Acked-by: Christian König
Acked-by: Vivek Kasireddy
---
drivers/dma-buf/udmabuf.c | 26 +-
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/d
table, and then pre-fault each pfn
into vma, when first access. Should know, if anything wrong when
pre-fault, will not report it's error, else, report when task access it
at the first time.
Suggested-by: Vivek Kasireddy
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c
vo.com/
v3
https://lore.kernel.org/all/20240813090518.3252469-1-l...@vivo.com/
v2
https://lore.kernel.org/all/20240805032550.3912454-1-l...@vivo.com/
v1
https://lore.kernel.org/all/20240801104512.4056860-1-l...@vivo.com/
Huan Yang (7):
udmabuf: pre-fault when first page fault
udmabuf: chan
array record each folio is ok.
Compare udmabuf_folio 24 byte, folio array is 8 byte. Even if array need
to be pgcnt*8, may waste some memory when use large folio.
The access of array is faster than list, also, if 4K, array can also
save memory than list.
Signed-off-by: Huan Yang
---
drivers/dm
se of folios when iter create head, just use max size
of item.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 165 +++---
1 file changed, 101 insertions(+), 64 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index 0bbc9df
in mmap,
when creating a large size udmabuf, this represents a considerable
overhead.
This patch fill vma area with pfn when the first page fault trigger, so,
any other access will not enter page fault.
Suggested-by: Vivek Kasireddy
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 26
, folios may use vmalloc to get memory, which can't
cache but return into pcp(or buddy) when vfree. So, each pin may waste
some time in folios array alloc.
This patch also reuse of folios when iter create head, just use max size
of item.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c
pgcnt*8, may waste some memory when use large folio.
The access of array is faster than list, also, if 4K, array can also
save memory than list.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 80 ++-
1 file changed, 37 insertions(+), 43 deletions(-)
t use page array to map, instead, use pfn array.
By this, we removed page usage in udmabuf totally.
Suggested-by: Vivek Kasireddy
Signed-off-by: Huan Yang
---
drivers/dma-buf/Kconfig | 1 +
drivers/dma-buf/udmabuf.c | 22 +++---
2 files changed, 16 insertions(+), 7 deletions(-
cation for any size and does
not affect the performance of kmalloc allocations.
Signed-off-by: Huan Yang
Acked-by: Christian König
Acked-by: Vivek Kasireddy
---
drivers/dma-buf/udmabuf.c | 26 +-
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/d
as "pgcnt".
make sure pass self test.
remove v1's patch4
v3
https://lore.kernel.org/all/20240813090518.3252469-1-l...@vivo.com/
v2
https://lore.kernel.org/all/20240805032550.3912454-1-l...@vivo.com/
v1
https://lore.kernel.org/all/20240801104512.4056860-1-l...@vivo.com/
H
the first page fault trigger, so,
any other access will not enter page fault.
Suggested-by: Vivek Kasireddy
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 26 --
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers
for memfds backed by shmem, but I suspect
this may not work if THP is enabled.
Thanks,
Vivek
By this, not only saves the overhead of the udmabuf_folio data structure
but also makes array access more cache-friendly.
Signed-off-by: Huan Yang
---
drivers/dm
folio to the unpin_list.
The outer loop of this patch iterates through folios, while the inner
loop correctly sets the folio and corresponding offset into the udmabuf
starting from the offset. if reach to pgcnt or nr_folios, end of loop.
By this, more readable.
Signed-off-by: Huan Yang
>folios is only contain's the folio's head page.
That mean we repeatedly mapped the folio head page to the vmalloc area.
Due to udmabuf can use hugetlb, if HVO enabled, tail page may not exist,
so, we can't use page array to map, instead, use pfn array.
Signed-off-by: Huan Ya
mmap,
when creating a large size udmabuf, this represents a considerable
overhead.
The current patch removes the page fault method of mmap and
instead fills pfn directly when mmap is triggered.
Signed-off-by: Huan Yang
Suggested-by: Vivek Kasireddy
---
drivers/dma-buf/udmabuf.c | 37
patch iterates through folios, while the inner
loop correctly sets the folio and corresponding offset into the udmabuf
starting from the offset. if reach to pgcnt or nr_folios, end of loop.
By this, more readable.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 65
cation for any size and does
not affect the performance of kmalloc allocations.
Signed-off-by: Huan Yang
Acked-by: Christian König
Acked-by: Vivek Kasireddy
---
drivers/dma-buf/udmabuf.c | 26 +-
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/d
e can iterate through the folios array during release and
unpin any folio that is different from the ones previously accessed.
By this, not only saves the overhead of the udmabuf_folio data structure
but also makes array access more cache-friendly.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udma
a considerable
overhead.
The current patch removes the page fault method of mmap and
instead fills pfn directly when mmap is triggered.
Signed-off-by: Huan Yang
Suggested-by: Vivek Kasireddy
---
drivers/dma-buf/udmabuf.c | 37 +++--
1 file changed, 15 insertions
t use page array to map, instead, use pfn array.
Signed-off-by: Huan Yang
Suggested-by: Vivek Kasireddy
---
drivers/dma-buf/udmabuf.c | 22 +++---
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index 3ec72d47bb
make sure pass self test.
remove v1's patch4
v2
https://lore.kernel.org/all/20240805032550.3912454-1-l...@vivo.com/
v1
https://lore.kernel.org/all/20240801104512.4056860-1-l...@vivo.com/
Huan Yang (5):
udmabuf: cancel mmap page fault, direct map it
udmabuf: change folios array
sound, but it may not save memory, only increase
context switch overhead.
whether opengl is available in the environment or not.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 39 ---
1 file changed, 16 insertions(+), 23 deletions(-)
diff --
not work if THP is enabled.
Considering the existence of HVO, I also feel the need to find further
optimization methods.
Thanks.
Thanks,
Vivek
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 167 ++
1 file changed, 61 insertions(+), 106
But, ubuf->folios is only contain's the folio's head page.
That mean we repeatedly mapped the folio head page to the vmalloc area.
This patch fix it, set each folio's page correct, so that pages array
contains right page, and then map into vmalloc area
Signed-off-by: Huan Yang
---
allocations.
Signed-off-by: Huan Yang
Acked-by: Christian König
---
drivers/dma-buf/udmabuf.c | 26 +-
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index 475268d4ebb1..af2391cea0bf 100644
--- a/driv
g the list during unpinning.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 167 ++
1 file changed, 61 insertions(+), 106 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index 9737f063b6b3..442ed99d8b33 100644
--- a/dr
access to virtual addresses needs to trap into
kernel mode.
Therefore, when creating a large size udmabuf, this represents a
considerable overhead.
The current patch removes the page fault method of mmap and
instead fills it directly when mmap is triggered.
Signed-off-by: Huan Yang
---
drivers/dma
cation for any size and does
not affect the performance of kmalloc allocations.
Signed-off-by: Huan Yang
Acked-by: Christian König
---
drivers/dma-buf/udmabuf.c | 26 +-
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/d
page, and then map into vmalloc area
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index af2391cea0bf..9737f063b6b3 100644
--- a/drivers/dma-buf/udmabuf.c
+++ b/dr
ns such as "pgcnt".
make sure pass self test.
remove v1's patch4
v1
https://lore.kernel.org/all/20240801104512.4056860-1-l...@vivo.com/
Huan Yang (4):
udmabuf: cancel mmap page fault, direct map it
udmabuf: change folios array from kmalloc to kvmalloc
fix vmap_udmabuf erro
arious data structures in udmabuf have the
following corresponding relationships:
pagecount * PAGESIZE = sum(folios_size(folios[i])) i=0->nr_folios
pagecount * PAGESIZE = sum(item_size[i]) i=0, item_count (do not
record)
item_offset use to record each memfd offset if exist, else 0.
Huan Y
在 2024/8/1 18:50, Christian König 写道:
Am 01.08.24 um 12:45 schrieb Huan Yang:
The current udmabuf mmap uses a page fault mechanism to populate the
vma.
However, the current udmabuf has already obtained and pinned the folio
upon completion of the creation.This means that the physical memory
s, we can accept the overhead of the udmabuf_folio structure
and the performance loss of traversing the list during unpinning.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 149 +-
1 file changed, 66 insertions(+), 83 deletions(-)
diff --git a/drive
* PAGESIZE = sum(folios_size(folios[i])) i=0->nr_folios
pagecount * PAGESIZE = sum(item_size[i]) i=0, item_count (do not
record)
item_offset use to record each memfd offset if exist, else 0.
Huan Yang (5):
udmabuf: cancel mmap page fault, direct map it
udmabuf: change folios array from
page, and then map into vmalloc area
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 17 +
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index a915714c5dce..7ed532342d7f 100644
--- a/drivers/dma-buf/udma
access to virtual addresses needs to trap into
kernel mode.
Therefore, when creating a large size udmabuf, this represents a
considerable overhead.
Therefore, the current patch removes the page fault method of mmap and
instead fills it directly when mmap is triggered.
Signed-off-by: Huan Yang
cation for any size and does
not affect the performance of kmalloc allocations.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 26 +-
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index d69aea
.
Or else, try alloc a new sgt, and cmpxchg to set it.
When the swap fails, it means that another process has set sg correctly.
Therefore, we reuse the new sg. If trigger by device, need invoke map to
sync it.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmab
在 2024/8/1 4:46, Daniel Vetter 写道:
On Tue, Jul 30, 2024 at 08:04:04PM +0800, Huan Yang wrote:
在 2024/7/30 17:05, Huan Yang 写道:
在 2024/7/30 16:56, Daniel Vetter 写道:
[? daniel.vet...@ffwll.ch ?
https://aka.ms/LearnAboutSenderIdentification?]
On Tue, Jul 30, 2024
在 2024/8/1 1:11, Christophe JAILLET 写道:
[Some people who received this message don't often get email from
christophe.jail...@wanadoo.fr. Learn why this is important at
https://aka.ms/LearnAboutSenderIdentification ]
Le 31/07/2024 à 09:37, Huan Yang a écrit :
The current udmabuf_
nto loop variables.
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 40 ---
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index 6604d91e7072..0285194e6b51 100644
--- a/drivers/dma-
page, and then map into vmalloc area
Signed-off-by: Huan Yang
---
drivers/dma-buf/udmabuf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index 047c3cd2ceff..6604d91e7072 100644
--- a/drivers/dma-buf/udmabuf.c
+++ b/dr
,
while also avoiding memory waste.
Signed-off-by: Huan Yang
---
v3 -> v2: fix error description.
v2 -> v1: fix double unregister, remove unlikely.
drivers/dma-buf/udmabuf.c | 19 +++
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/dma-buf/udmabuf.c b/drive
在 2024/7/31 14:26, Huan Yang 写道:
The current udmabuf_folio contains a list_head and the corresponding
folio pointer, with a size of 24 bytes. udmabuf_folio uses kmalloc to
allocate memory.
However, kmalloc is a public pool, starting from 64 bytes. This means
that each udmabuf_folio allocation
1 - 100 of 133 matches
Mail list logo