Skip to contentSkip to conversation

tests/gem_evict_everything: Use bo_count instead of count where intended

PATCH In review Tvrtko Ursulin 2 participants 5 messages Dec 6, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/gem_evict_everything: Use bo_count instead of count where intended

From: Tvrtko Ursulin <[email protected]>

Don't see that it causes a problem but it looks it was intended to use bo_count at these places.

Also using count to determine number of processes does not make sense unless thousands of cores.

---
 tests/gem_evict_everything.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
tests/gem_evict_everything.c +5 -7
index 41abef7..90c3ae1 100644
@@ -135,8 +135,6 @@ static void exchange_uint32_t(void *array, unsigned i, unsigned j)
 	i_arr[j] = i_tmp;
 }
 
-#define min(a, b) ((a) < (b) ? (a) : (b))
-
 #define INTERRUPTIBLE	(1 << 0)
 #define SWAPPING	(1 << 1)
 #define DUP_DRMFD	(1 << 2)
@@ -168,7 +166,7 @@ static void forked_evictions(int fd, int size, int count,
 	for (n = 0; n < bo_count; n++)
 		bo[n] = gem_create(fd, size);
 
-	igt_fork(i, min(count, min(num_threads * 5, 12))) {
+	igt_fork(i, num_threads * 4) {
 		int realfd = fd;
 		int num_passes = flags & SWAPPING ? 10 : 100;
 
@@ -184,7 +182,7 @@ static void forked_evictions(int fd, int size, int count,
 			realfd = drm_open_any();
 
 			/* We can overwrite the bo array since we're forked. */
-			for (l = 0; l < count; l++) {
+			for (l = 0; l < bo_count; l++) {
 				uint32_t flink;
 
 				flink = gem_flink(fd, bo[l]);
@@ -194,9 +192,9 @@ static void forked_evictions(int fd, int size, int count,
 		}
 
 		for (pass = 0; pass < num_passes; pass++) {
-			copy(realfd, bo[0], bo[1], bo, count, 0);
+			copy(realfd, bo[0], bo[1], bo, bo_count, 0);
 
-			for (l = 0; l < count && (flags & MEMORY_PRESSURE); l++) {
+			for (l = 0; l < bo_count && (flags & MEMORY_PRESSURE); l++) {
 				uint32_t *base = gem_mmap__cpu(realfd, bo[l],
 							       size,
 							       PROT_READ | PROT_WRITE);
@@ -244,7 +242,7 @@ static void swapping_evictions(int fd, int size, int count)
 		igt_permute_array(bo, bo_count, exchange_uint32_t);
 
 		for (pass = 0; pass < 100; pass++) {
-			copy(fd, bo[0], bo[1], bo, count, 0);
+			copy(fd, bo[0], bo[1], bo, bo_count, 0);
 		}
 	}
 
Signature · 1 line
1.8.4.3
#1 lore raw
Quoted 27 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Don't see that it causes a problem but it looks it was intended to use bo_count at these places.

Also using count to determine number of processes does not make sense unless thousands of cores.

---
 tests/gem_evict_everything.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
tests/gem_evict_everything.c +0 -2
index 41abef7..90c3ae1 100644
@@ -135,8 +135,6 @@ static void exchange_uint32_t(void *array, unsigned i, unsigned j)
 	i_arr[j] = i_tmp;
 }
 
-#define min(a, b) ((a) < (b) ? (a) : (b))
-
 #define INTERRUPTIBLE	(1 << 0)
 #define SWAPPING	(1 << 1)
 #define DUP_DRMFD	(1 << 2)

tests/gem_evict_everything.c static void forked_evictions(int fd, int size, int count, · line 169

Quoted 5 lines
tests/gem_evict_everything.c +1 -1
@@ -168,7 +166,7 @@ static void forked_evictions(int fd, int size, int count,
 	for (n = 0; n < bo_count; n++)
 		bo[n] = gem_create(fd, size);
 
-	igt_fork(i, min(count, min(num_threads * 5, 12))) {
+	igt_fork(i, num_threads * 4) {

You've killed the min( , 12) here ... that'll hurt on big desktops. Otherwise patch looks good.
-Daniel

Quoted 40 lines
tests/gem_evict_everything.c +4 -4
 		int realfd = fd;
 		int num_passes = flags & SWAPPING ? 10 : 100;
 
@@ -184,7 +182,7 @@ static void forked_evictions(int fd, int size, int count,
 			realfd = drm_open_any();
 
 			/* We can overwrite the bo array since we're forked. */
-			for (l = 0; l < count; l++) {
+			for (l = 0; l < bo_count; l++) {
 				uint32_t flink;
 
 				flink = gem_flink(fd, bo[l]);
@@ -194,9 +192,9 @@ static void forked_evictions(int fd, int size, int count,
 		}
 
 		for (pass = 0; pass < num_passes; pass++) {
-			copy(realfd, bo[0], bo[1], bo, count, 0);
+			copy(realfd, bo[0], bo[1], bo, bo_count, 0);
 
-			for (l = 0; l < count && (flags & MEMORY_PRESSURE); l++) {
+			for (l = 0; l < bo_count && (flags & MEMORY_PRESSURE); l++) {
 				uint32_t *base = gem_mmap__cpu(realfd, bo[l],
 							       size,
 							       PROT_READ | PROT_WRITE);
@@ -244,7 +242,7 @@ static void swapping_evictions(int fd, int size, int count)
 		igt_permute_array(bo, bo_count, exchange_uint32_t);
 
 		for (pass = 0; pass < 100; pass++) {
-			copy(fd, bo[0], bo[1], bo, count, 0);
+			copy(fd, bo[0], bo[1], bo, bo_count, 0);
 		}
 	}
 
Signature · 6 lines
1.8.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#2 lore raw
Quoted 31 lines · Daniel Vetter
Quoted 30 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Don't see that it causes a problem but it looks it was intended to use bo_count at these places.

Also using count to determine number of processes does not make sense unless thousands of cores.

---
 tests/gem_evict_everything.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
tests/gem_evict_everything.c +0 -2
index 41abef7..90c3ae1 100644
@@ -135,8 +135,6 @@ static void exchange_uint32_t(void *array, unsigned i, unsigned j)
 	i_arr[j] = i_tmp;
 }
 
-#define min(a, b) ((a) < (b) ? (a) : (b))
-
 #define INTERRUPTIBLE	(1 << 0)
 #define SWAPPING	(1 << 1)
 #define DUP_DRMFD	(1 << 2)
@@ -168,7 +166,7 @@ static void forked_evictions(int fd, int size, int count,
 	for (n = 0; n < bo_count; n++)
 		bo[n] = gem_create(fd, size);
 
Quoted 5 lines

tests/gem_evict_everything.c static void forked_evictions(int fd, int size, int count, · line 169

Quoted 2 lines
tests/gem_evict_everything.c +1 -1
-	igt_fork(i, min(count, min(num_threads * 5, 12))) {
+	igt_fork(i, num_threads * 4) {

You've killed the min( , 12) here ... that'll hurt on big desktops. Otherwise patch looks good.

It was hard for me to know what kind of stress was desired there. Thinking of typical cases, single core single thread gives five "stressers", more typical 2x1 gives 10. So it seems the whole calculation will typically be between 10 and 12, 5 and 12 conditionally. Which almost sounds a bit pointless.. I mean to have the calculation as it was at all.

Tvrtko

#3 lore raw
Quoted 38 lines · Tvrtko Ursulin
Quoted 31 lines · Daniel Vetter
Quoted 30 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Don't see that it causes a problem but it looks it was intended to use bo_count at these places.

Also using count to determine number of processes does not make sense unless thousands of cores.

---
 tests/gem_evict_everything.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
tests/gem_evict_everything.c +0 -2
index 41abef7..90c3ae1 100644
@@ -135,8 +135,6 @@ static void exchange_uint32_t(void *array, unsigned i, unsigned j)
 	i_arr[j] = i_tmp;
 }
 
-#define min(a, b) ((a) < (b) ? (a) : (b))
-
 #define INTERRUPTIBLE	(1 << 0)
 #define SWAPPING	(1 << 1)
 #define DUP_DRMFD	(1 << 2)
@@ -168,7 +166,7 @@ static void forked_evictions(int fd, int size, int count,
 	for (n = 0; n < bo_count; n++)
 		bo[n] = gem_create(fd, size);
 
Quoted 5 lines

tests/gem_evict_everything.c static void forked_evictions(int fd, int size, int count, · line 169

Quoted 2 lines
tests/gem_evict_everything.c +1 -1
-	igt_fork(i, min(count, min(num_threads * 5, 12))) {
+	igt_fork(i, num_threads * 4) {

You've killed the min( , 12) here ... that'll hurt on big desktops. Otherwise patch looks good.

Quoted 6 lines

It was hard for me to know what kind of stress was desired there. Thinking of typical cases, single core single thread gives five "stressers", more typical 2x1 gives 10. So it seems the whole calculation will typically be between 10 and 12, 5 and 12 conditionally. Which almost sounds a bit pointless.. I mean to have the calculation as it was at all.

Well, igt stresstests are mostly random whacking until I'm fairly happy on a set of machines. But If you kill that max 12 runtime on bigger stuff will go through the roof for sure. And even on my really old single-core machines it's still ok. I suspect due to the thrashing the depency is fairly non-linear.

Longer-term I want to speed up all these memory thrashing tests by mlocking most of main memory and so removing it from consideration. But that's a bit of work to set up and roll out across all tests. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#4 lore raw
Quoted 46 lines · Daniel Vetter
Quoted 38 lines · Tvrtko Ursulin
Quoted 31 lines · Daniel Vetter
Quoted 30 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Don't see that it causes a problem but it looks it was intended to use bo_count at these places.

Also using count to determine number of processes does not make sense unless thousands of cores.

---
 tests/gem_evict_everything.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
tests/gem_evict_everything.c +0 -2
index 41abef7..90c3ae1 100644
@@ -135,8 +135,6 @@ static void exchange_uint32_t(void *array, unsigned i, unsigned j)
 	i_arr[j] = i_tmp;
 }
 
-#define min(a, b) ((a) < (b) ? (a) : (b))
-
 #define INTERRUPTIBLE	(1 << 0)
 #define SWAPPING	(1 << 1)
 #define DUP_DRMFD	(1 << 2)
@@ -168,7 +166,7 @@ static void forked_evictions(int fd, int size, int count,
 	for (n = 0; n < bo_count; n++)
 		bo[n] = gem_create(fd, size);
 
Quoted 5 lines

tests/gem_evict_everything.c static void forked_evictions(int fd, int size, int count, · line 169

Quoted 2 lines
tests/gem_evict_everything.c +1 -1
-	igt_fork(i, min(count, min(num_threads * 5, 12))) {
+	igt_fork(i, num_threads * 4) {

You've killed the min( , 12) here ... that'll hurt on big desktops. Otherwise patch looks good.

Quoted 6 lines

It was hard for me to know what kind of stress was desired there. Thinking of typical cases, single core single thread gives five "stressers", more typical 2x1 gives 10. So it seems the whole calculation will typically be between 10 and 12, 5 and 12 conditionally. Which almost sounds a bit pointless.. I mean to have the calculation as it was at all.

Quoted 5 lines

Well, igt stresstests are mostly random whacking until I'm fairly happy on a set of machines. But If you kill that max 12 runtime on bigger stuff will go through the roof for sure. And even on my really old single-core machines it's still ok. I suspect due to the thrashing the depency is fairly non-linear.

OK, I'll send a version with that clamp put back in.

Tvrtko