Skip to contentSkip to conversation

igt/gem_shrink: touch each page in pwrite_/pread_

PATCH New Ashutosh Dixit 1 participant 1 message May 8, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igt/gem_shrink: touch each page in pwrite_/pread_

pwrite_() and pread_() purport to read each page but weren't.

Fixes 88bfe6ac41 ("igt/gem_shrink: Add pread/pwrite stress)

---
 tests/i915/gem_shrink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/i915/gem_shrink.c +2 -2
index c9964ccc0..f6f1144ba 100644
@@ -58,7 +58,7 @@ static void pwrite_(int fd, uint64_t alloc)
 	uint32_t tmp;
 	uint32_t handle = gem_create(fd, alloc);
 	for (int page = 0; page < alloc>>12; page++)
-		gem_write(fd, handle, (page + page % 4095) & ~3, &tmp, 4);
+		gem_write(fd, handle, page << 12, &tmp, 4);
 	gem_madvise(fd, handle, I915_MADV_DONTNEED);
 }
 
@@ -67,7 +67,7 @@ static void pread_(int fd, uint64_t alloc)
 	uint32_t tmp;
 	uint32_t handle = gem_create(fd, alloc);
 	for (int page = 0; page < alloc>>12; page++)
-		gem_read(fd, handle, (page + page % 4095) & ~3, &tmp, 4);
+		gem_read(fd, handle, page << 12, &tmp, 4);
 	gem_madvise(fd, handle, I915_MADV_DONTNEED);
 }
 
Signature · 6 lines
2.26.0

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev