diff options
author | Jesper Dangaard Brouer <brouer@redhat.com> | 2014-08-21 16:39:14 +0200 |
---|---|---|
committer | Jesper Dangaard Brouer <brouer@redhat.com> | 2014-08-21 16:39:36 +0200 |
commit | 76486ece10c6dbada8d78bbe50aa8254d3496a47 (patch) | |
tree | 51db5740d5914e29980b90b095bd9785024aa27d /trafgen.c | |
parent | 9e031cbba84383c1948abdfe141cd7ecc1ab37f9 (diff) |
trafgen: add option to not adjust system socket mem during testrun
The default behavior of trafgen is to boost the systems default
socket memory limits during a testrun. This behaviour does not
always result in improved performance, because this will stress
the kernels SLAB allocators unnecessary.
Introducing an option "--no-sock-mem" that instruct trafgen
to not perform any socket memory adjustments.
Fixes: #130
Acked-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Diffstat (limited to 'trafgen.c')
-rw-r--r-- | trafgen.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -98,6 +98,7 @@ static const struct option long_options[] = { {"group", required_argument, NULL, 'g'}, {"prio-high", no_argument, NULL, 'H'}, {"notouch-irq", no_argument, NULL, 'Q'}, + {"no-sock-mem", no_argument, NULL, 'A'}, {"qdisc-path", no_argument, NULL, 'q'}, {"jumbo-support", no_argument, NULL, 'J'}, {"no-cpu-stats", no_argument, NULL, 'C'}, @@ -161,6 +162,7 @@ static void __noreturn help(void) " -u|--user <userid> Drop privileges and change to userid\n" " -g|--group <groupid> Drop privileges and change to groupid\n" " -H|--prio-high Make this high priority process\n" + " -m|--no-sock-mem Don't tune core socket memory\n" " -Q|--notouch-irq Do not touch IRQ CPU affinity of NIC\n" " -q|--qdisc-path Enabled qdisc kernel path (default off since 3.14)\n" " -V|--verbose Be more verbose\n" @@ -851,7 +853,7 @@ static unsigned int generate_srand_seed(void) int main(int argc, char **argv) { bool slow = false, invoke_cpp = false, reseed = true, cpustats = true; - bool prio_high = false, set_irq_aff = true; + bool prio_high = false, set_irq_aff = true, set_sock_mem = true; int c, opt_index, vals[4] = {0}, irq; uint64_t gap = 0; unsigned int i, j; @@ -902,6 +904,9 @@ int main(int argc, char **argv) case 'H': prio_high = true; break; + case 'A': + set_sock_mem = false; + break; case 'Q': set_irq_aff = false; break; @@ -1050,7 +1055,8 @@ int main(int argc, char **argv) set_sched_status(SCHED_FIFO, sched_get_priority_max(SCHED_FIFO)); } - set_system_socket_memory(vals, array_size(vals)); + if (set_sock_mem) + set_system_socket_memory(vals, array_size(vals)); xlockme(); if (ctx.rfraw) { @@ -1096,7 +1102,8 @@ int main(int argc, char **argv) if (ctx.rfraw) leave_rfmon_mac80211(ctx.device); - reset_system_socket_memory(vals, array_size(vals)); + if (set_sock_mem) + reset_system_socket_memory(vals, array_size(vals)); for (i = 0, tx_packets = tx_bytes = 0; i < ctx.cpus; i++) { while ((__get_state(i) & CPU_STATS_STATE_RES) == 0) |