* + selftests-udmabuf-fix-hugepage-size-calculation.patch added to mm-nonmm-unstable branch
@ 2026-01-18 20:54 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-01-18 20:54 UTC (permalink / raw)
To: mm-commits, vivek.kasireddy, shuah, richard.weiyang, kraxel, akpm,
zishun.yi.dev, akpm
The patch titled
Subject: selftests: udmabuf: fix hugepage size calculation
has been added to the -mm mm-nonmm-unstable branch. Its filename is
selftests-udmabuf-fix-hugepage-size-calculation.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-udmabuf-fix-hugepage-size-calculation.patch
This patch will later appear in the mm-nonmm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: zishun yi <zishun.yi.dev@gmail.com>
Subject: selftests: udmabuf: fix hugepage size calculation
Date: Sun, 18 Jan 2026 21:51:26 +0800
udmabuf's test 6 and 7 is intended to verify the behavior of 2MB huge
pages migration, but the helper function still calculates the size using
standard (4KB) pages.
Link: https://lkml.kernel.org/r/20260118135126.102472-1-zishun.yi.dev@gmail.com
Signed-off-by: zishun yi <zishun.yi.dev@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
tools/testing/selftests/drivers/dma-buf/udmabuf.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/tools/testing/selftests/drivers/dma-buf/udmabuf.c~selftests-udmabuf-fix-hugepage-size-calculation
+++ a/tools/testing/selftests/drivers/dma-buf/udmabuf.c
@@ -69,7 +69,7 @@ static int create_udmabuf_list(int devfd
for (i = 0; i < NUM_ENTRIES; i++) {
list->list[i].memfd = memfd;
list->list[i].offset = i * (memfd_size / NUM_ENTRIES);
- list->list[i].size = getpagesize() * NUM_PAGES;
+ list->list[i].size = page_size * NUM_PAGES;
}
list->count = NUM_ENTRIES;
@@ -115,8 +115,8 @@ static int compare_chunks(void *addr1, v
while (i < NUM_ENTRIES) {
off = i * (memfd_size / NUM_ENTRIES);
for (j = 0; j < NUM_PAGES; j++, k++) {
- char1 = *((char *)addr1 + off + (j * getpagesize()));
- char2 = *((char *)addr2 + (k * getpagesize()));
+ char1 = *((char *)addr1 + off + (j * page_size));
+ char2 = *((char *)addr2 + (k * page_size));
if (char1 != char2) {
ret = -1;
goto err;
@@ -126,7 +126,7 @@ static int compare_chunks(void *addr1, v
}
err:
munmap(addr1, memfd_size);
- munmap(addr2, NUM_ENTRIES * NUM_PAGES * getpagesize());
+ munmap(addr2, NUM_ENTRIES * NUM_PAGES * page_size);
return ret;
}
@@ -240,7 +240,7 @@ int main(int argc, char *argv[])
addr1 = mmap_fd(memfd, size);
write_to_memfd(addr1, size, 'a');
buf = create_udmabuf_list(devfd, memfd, size);
- addr2 = mmap_fd(buf, NUM_PAGES * NUM_ENTRIES * getpagesize());
+ addr2 = mmap_fd(buf, NUM_PAGES * NUM_ENTRIES * page_size);
write_to_memfd(addr1, size, 'b');
ret = compare_chunks(addr1, addr2, size);
if (ret < 0)
@@ -256,7 +256,7 @@ int main(int argc, char *argv[])
size = MEMFD_SIZE * page_size;
memfd = create_memfd_with_seals(size, true);
buf = create_udmabuf_list(devfd, memfd, size);
- addr2 = mmap_fd(buf, NUM_PAGES * NUM_ENTRIES * getpagesize());
+ addr2 = mmap_fd(buf, NUM_PAGES * NUM_ENTRIES * page_size);
addr1 = mmap_fd(memfd, size);
write_to_memfd(addr1, size, 'a');
write_to_memfd(addr1, size, 'b');
_
Patches currently in -mm which might be from zishun.yi.dev@gmail.com are
selftests-udmabuf-fix-hugepage-size-calculation.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-01-18 20:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-18 20:54 + selftests-udmabuf-fix-hugepage-size-calculation.patch added to mm-nonmm-unstable branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.