Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Feb 2015 13:17:42 -0600
From:      Jim Thompson <jim@netgate.com>
To:        Adrian Chadd <adrian@freebsd.org>
Cc:        FreeBSD Net <freebsd-net@freebsd.org>
Subject:   Re: Silly experiments with netisr
Message-ID:  <B3C9FDF8-1B60-458A-A3D3-ECB8B723A641@netgate.com>
In-Reply-To: <CAJ-VmonX%2B_8g1Z1d6M4atC0_YriJq6scaXGF27yapfg5WyfGUg@mail.gmail.com>
References:  <54D3BE67.8060502@ignoranthack.me> <CAJ-VmonX%2B_8g1Z1d6M4atC0_YriJq6scaXGF27yapfg5WyfGUg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

> On Feb 5, 2015, at 1:13 PM, Adrian Chadd <adrian@freebsd.org> wrote:
>=20
> On 5 February 2015 at 11:03, Sean Bruno <sbruno@ignoranthack.me =
<mailto:sbruno@ignoranthack.me>> wrote:
>>=20
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA512
>>=20
>> Some questions came up around the office and we ended up doing some
>> quite silly things with lo0 and netcat.
>>=20
>> If one runs a continuous netcat on localhost to another netcat =
listener
>> on localhost that writes the output to /dev/null, netisr gets super =
busy
>> doing stuff/things.
>>=20
>> E.g.
>>  -- listener running "nc -k -l 10000 > /dev/null"
>>  -  sender running in a while loop "nc -N localhost 10000 <
>> /var/tmp/testfile"
>>=20
>> Interesting things start happening on the machine.  top -SH shows =
netisr
>> eating up about 1/2 of a cpu core.  If you drop the MTU on lo0 to =
1500
>> (so that it looks like something in the real world), netisr will peg =
out
>> a cpu core.  This seems logical, in that smaller MTU means busier
>> netisr.  Its interesting though.
>>=20
>> Looking at some pmcstat things, shows that the system is busilly
>> chugging along in tcp_do_segment().  I wonder if this is meaningful =
in
>> anyway or just "interesting".
>>=20
>> PMC: [FR_RETIRED_X86_INSTRUCTIONS] Samples: 267614 (100.0%) , 12350
>> unresolved
>=20
> UHm, on a recent intel, use CPU_CLK_UNHALTED instead, so you get an
> idea of which instructions are spending the most time doing "stuff".
> Some instructions are costlier than others (eg things that cause
> memory bus stalls.)
>=20
>> %SAMP IMAGE      FUNCTION             CALLERS
>>  5.5 kernel     in_cksumdata         in_cksum_skip
>=20
> .. we're checksumming localhost tcp? :)

Of course we are.

The more damning part is the 7.0% of samples that pf consumes.

Jim

>=20
> -adrian
>=20
>>  5.0 kernel     tcp_output           tcp_do_segment:4.2 =
tcp_usr_rcvd:0.5
>>  4.6 kernel     __rw_wlock_hard      tcp_usr_send:3.7 =
tcp_usr_rcvd:0.8
>>  3.8 pf.ko      pf_test              pf_check_in:2.0 pf_check_out:1.8
>>  3.6 kernel     sched_idletd         fork_exit
>>  3.2 pf.ko      pf_test_state_tcp    pf_test
>>  3.1 kernel     bzero                pf_test:0.8 =
pf_test_state_tcp:0.7
>>  3.1 kernel     bcopy                m_copydata:1.3 =
tcp_addoptions:0.7
>> tcp_dooptions:0.5
>>  2.7 kernel     tcp_do_segment       tcp_input
>>=20
>>=20
>> sean
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v2
>>=20
>> iQF8BAEBCgBmBQJU075kXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
>> ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRCQUFENDYzMkU3MTIxREU4RDIwOTk3REQx
>> MjAxRUZDQTFFNzI3RTY0AAoJEBIB78oecn5kc4kH/02ttXzvapAG2PSML9Ml0Kwf
>> XblpOHnrhUU8jsTauGhh8q4C94rb9hFDCzL4cEAI87QMXoBQHi9CWE0v/XdeR+8M
>> ajpHlNyd78XbmIKOVksesYWzLbVFjC0A3emnkH4dUX1XD6tJoihVaUQVcrAbNm+I
>> p6Z4yXrOXUP9UxBgkCSe5m3Y/K3vcmIPvFSnO/nN/2tckEh6+uuj1n3QyFXkUJJg
>> 9erFanvDXr3nOyR6IWXIKxuy1yta32SpOPxywIl81qSBh1n/IOor41WqpzOnlNdM
>> d0np+ZD/d+Z9OQJZnuJunCrV6Cv2EFKJe5qBzCdOjLj0KvpNDnFXyndWpeXyvgI=3D
>> =3D+FSJ
>> -----END PGP SIGNATURE-----
>>=20
>>=20
>> _______________________________________________
>> freebsd-net@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-net
>> To unsubscribe, send any mail to =
"freebsd-net-unsubscribe@freebsd.org"
> _______________________________________________
> freebsd-net@freebsd.org <mailto:freebsd-net@freebsd.org> mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net =
<http://lists.freebsd.org/mailman/listinfo/freebsd-net>;
> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org =
<mailto:freebsd-net-unsubscribe@freebsd.org>"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B3C9FDF8-1B60-458A-A3D3-ECB8B723A641>