summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesper Dangaard Brouer <brouer@redhat.com>2014-08-21 16:39:14 +0200
committerJesper Dangaard Brouer <brouer@redhat.com>2014-08-21 16:39:36 +0200
commit76486ece10c6dbada8d78bbe50aa8254d3496a47 (patch)
tree51db5740d5914e29980b90b095bd9785024aa27d
parent9e031cbba84383c1948abdfe141cd7ecc1ab37f9 (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>
-rw-r--r--trafgen.89
-rw-r--r--trafgen.c13
2 files changed, 19 insertions, 3 deletions
diff --git a/trafgen.8 b/trafgen.8
index 4a888c5..31c2f52 100644
--- a/trafgen.8
+++ b/trafgen.8
@@ -152,6 +152,15 @@ scheduling rate resp. CPU time. This is however not the default setting, since
it could lead to starvation of other processes, for example low priority kernel
threads.
.PP
+.SS -A, --no-sock-mem
+Do not change systems default socket memory setting during testrun.
+Default is to boost socket buffer memory during the test to:
+.PP
+ /proc/sys/net/core/rmem_default:4194304
+ /proc/sys/net/core/wmem_default:4194304
+ /proc/sys/net/core/rmem_max:104857600
+ /proc/sys/net/core/wmem_max:104857600
+.PP
.SS -Q, --notouch-irq
Do not reassign the NIC's IRQ CPU affinity settings.
.PP
diff --git a/trafgen.c b/trafgen.c
index 307d596..690e98e 100644
--- a/trafgen.c
+++ b/trafgen.c
@@ -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)