Re: [PATCH i-g-t 2/5] gem_wsim: Round mmap to page size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 28/02/2019 14:25, Chris Wilson wrote:
Quoting Tvrtko Ursulin (2019-02-28 14:18:25)
From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>

mmap(2) mandates size is page aligned.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
---
  benchmarks/gem_wsim.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index 0a5abc08d8c2..57ceb983cf82 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -737,6 +737,7 @@ init_bb(struct w_step *w, unsigned int flags)
  {
         const unsigned int arb_period =
                         get_bb_sz(w->preempt_us) / sizeof(uint32_t);
+       const unsigned int mmap_len = ALIGN(w->bb_sz, 4096);
         unsigned int i;
         uint32_t *ptr;

You only need to do it for

ww->bb_sz = ALIGN(get_bb_sz(), 4096);

All batch lengths are start = ww->bb_sz - get_bb_sz() and so remain
correct. Right?

I think so. I have one more assignment site of w->bb_sz in the upcoming code so it was 2 : 2 and I flipped a coin. Actually I wanted to make it explicit what I am fixing - the mmap size. But now you'll say batch size is also implicitly rounded.. oh well.. I prefer the explicit round up at mmap time.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux