Re: [PATCH igt 2/3] benchmarks/gem_syslatency: Apply vmpressure, measure page allocation

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

 



On Wed, 2017-09-27 at 10:41 +0100, Chris Wilson wrote:
> Quoting Joonas Lahtinen (2017-09-27 09:52:42)
> > On Mon, 2017-09-25 at 21:26 +0100, Chris Wilson wrote:
> > > +static void *sys_thp_alloc(void *arg)
> > > +{
> > > +     struct sys_wait *w = arg;
> > > +     struct timespec now;
> > > +
> > > +     clock_gettime(CLOCK_MONOTONIC, &now);
> > > +     while (!done) {
> > > +             const size_t sz = 2 << 20;
> > > +             const struct timespec start = now;
> > > +             void *ptr;
> > > +
> > > +             ptr = mmap(NULL, sz,
> > > +                        PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS,
> > > +                        -1, 0);
> > > +             assert(ptr != MAP_FAILED);
> > > +             madvise(ptr, sz, MADV_HUGEPAGE);
> > > +             for (int page = 0; page < 2 << 20 >> 12; page++)
> > > +                     *((volatile uint32_t *)ptr + (page << 12 >> 2)) = 0;
> > 
> > But what's the point in this iteration, we iterate from 0 to 512 page
> > index (sz/PAGE_SIZE would be so much easier) and then write to to not
> > each page but interleave four page writes per page and 3/4 of pages
> > never get written? If this is intentional, please drop a comment.
> 
> -               for (int page = 0; page < 2 << 20 >> 12; page++)
> -                       *((volatile uint32_t *)ptr + (page << 12 >> 2)) = 0;

Yes, why not write /sizeof() like civilized people do :P

> +               for (size_t page = 0; page < sz; page += PAGE_SIZE)
> +                       *(volatile uint32_t *)(ptr + page) = 0;

Thats much more clear.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>

It seems program usage info is not a hot feature for benchmarks.

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux