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 Mon, 2017-09-25 at 21:26 +0100, Chris Wilson wrote:
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> ---
>  benchmarks/gem_syslatency.c | 86 +++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 83 insertions(+), 3 deletions(-)
> 
> diff --git a/benchmarks/gem_syslatency.c b/benchmarks/gem_syslatency.c
> index 4ed23638..b8788497 100644
> --- a/benchmarks/gem_syslatency.c
> +++ b/benchmarks/gem_syslatency.c
> @@ -29,6 +29,7 @@
>  #include <stdio.h>
>  #include <string.h>
>  #include <fcntl.h>
> +#include <ftw.h>
>  #include <inttypes.h>
>  #include <pthread.h>
>  #include <sched.h>
> @@ -51,6 +52,7 @@ static volatile int done;
>  struct gem_busyspin {
>  	pthread_t thread;
>  	unsigned long count;
> +	bool leak;
>  };

I know we all binary arithmetic, but can I still ask


#define M()
#define K()

Or something.

>  
>  struct sys_wait {
> @@ -93,6 +95,7 @@ static void *gem_busyspin(void *arg)
>  	struct gem_busyspin *bs = arg;
>  	struct drm_i915_gem_execbuffer2 execbuf;
>  	struct drm_i915_gem_exec_object2 obj;
> +	const unsigned sz = bs->leak ? 16 << 20 : 4 << 10;

Beause, this is quite OK still.

> @@ -180,6 +188,33 @@ static void *sys_wait(void *arg)
>  	return NULL;
>  }
>  
> +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.

Other than that,

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

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