Skip to content

Commit

Permalink
stress-iomix: force page to be be read even on high optimization levels
Browse files Browse the repository at this point in the history
Signed-off-by: Colin Ian King <[email protected]>
  • Loading branch information
Colin Ian King committed Feb 18, 2017
1 parent 396b8e3 commit 57359ce
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions stress-iomix.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,16 @@ static void stress_iomix_rd_wr_mmap(const args_t *args, const int fd)
PROT_READ | PROT_WRITE, flags, fd, posn);
}
for (i = 0; i < SIZEOF_ARRAY(mmaps); i++) {
char buffer[page_size];

if (mmaps[i] != MAP_FAILED) {
memcpy(buffer, mmaps[i], page_size);
size_t j;
uint64_t sum = 0;
uint8_t *buffer = (uint8_t *)mmaps[i];

/* Force page data to be read */
for (j = 0; j < page_size; j++)
sum += buffer[j];
uint64_put(sum);

stress_strnrnd(mmaps[i], page_size);
(void)shim_msync(mmaps[i], page_size,
(mwc32() & 1) ? MS_ASYNC : MS_SYNC);
Expand Down

0 comments on commit 57359ce

Please sign in to comment.