Skip to content

Commit

Permalink
selftests/net: relax cpu affinity requirement in msg_zerocopy test
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
wdebruij authored and davem330 committed Aug 5, 2020
1 parent adf7341 commit 16f6458
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tools/testing/selftests/net/msg_zerocopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ static int do_setcpu(int cpu)
CPU_ZERO(&mask);
CPU_SET(cpu, &mask);
if (sched_setaffinity(0, sizeof(mask), &mask))
error(1, 0, "setaffinity %d", cpu);

if (cfg_verbose)
fprintf(stderr, "cpu: unable to pin, may increase variance.\n");
else if (cfg_verbose)
fprintf(stderr, "cpu: %u\n", cpu);

return 0;
Expand Down

0 comments on commit 16f6458

Please sign in to comment.