Skip to content

Commit 16f6458

Browse files
wdebruijdavem330
authored andcommitted
selftests/net: relax cpu affinity requirement in msg_zerocopy test
The msg_zerocopy test pins the sender and receiver threads to separate cores to reduce variance between runs. But it hardcodes the cores and skips core 0, so it fails on machines with the selected cores offline, or simply fewer cores. The test mainly gives code coverage in automated runs. The throughput of zerocopy ('-z') and non-zerocopy runs is logged for manual inspection. Continue even when sched_setaffinity fails. Just log to warn anyone interpreting the data. Fixes: 07b65c5 ("test: add msg_zerocopy test") Reported-by: Colin Ian King <[email protected]> Signed-off-by: Willem de Bruijn <[email protected]> Acked-by: Colin Ian King <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent adf7341 commit 16f6458

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tools/testing/selftests/net/msg_zerocopy.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,8 @@ static int do_setcpu(int cpu)
125125
CPU_ZERO(&mask);
126126
CPU_SET(cpu, &mask);
127127
if (sched_setaffinity(0, sizeof(mask), &mask))
128-
error(1, 0, "setaffinity %d", cpu);
129-
130-
if (cfg_verbose)
128+
fprintf(stderr, "cpu: unable to pin, may increase variance.\n");
129+
else if (cfg_verbose)
131130
fprintf(stderr, "cpu: %u\n", cpu);
132131

133132
return 0;

0 commit comments

Comments
 (0)