lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <309370ca.9ca1.1932a1ac39d.Coremail.00107082@163.com>
Date: Thu, 14 Nov 2024 17:56:57 +0800 (CST)
From: "David Wang" <00107082@....com>
To: "Paolo Abeni" <pabeni@...hat.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org, 
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net/core/net-procfs: use seq_put_decimal_ull_width()
 for decimal values in /proc/net/dev



At 2024-11-14 17:17:32, "Paolo Abeni" <pabeni@...hat.com> wrote:
>
>
>On 11/10/24 05:52, David Wang wrote:
>> seq_printf() is costy, when reading /proc/net/dev, profiling indicates
>> about 13% samples of seq_printf():
>> 	dev_seq_show(98.350% 428046/435229)
>> 	    dev_seq_printf_stats(99.777% 427092/428046)
>> 		dev_get_stats(86.121% 367814/427092)
>> 		    rtl8169_get_stats64(98.519% 362365/367814)
>> 		    dev_fetch_sw_netstats(0.554% 2038/367814)
>> 		    loopback_get_stats64(0.250% 919/367814)
>> 		    dev_get_tstats64(0.077% 284/367814)
>> 		    netdev_stats_to_stats64(0.051% 189/367814)
>> 		    _find_next_bit(0.029% 106/367814)
>> 		seq_printf(13.719% 58594/427092)
>> And on a system with one wireless interface, timing for 1 million rounds of
>> stress reading /proc/net/dev:
>> 	real	0m51.828s
>> 	user	0m0.225s
>> 	sys	0m51.671s
>> On average, reading /proc/net/dev takes ~0.051ms
>> 
>> With this patch, extra costs parsing format string by seq_printf() can be
>> optimized out, and the timing for 1 million rounds of read is:
>> 	real	0m49.127s
>> 	user	0m0.295s
>> 	sys	0m48.552s
>> On average, ~0.048ms reading /proc/net/dev, a ~6% improvement.
>> 
>> Even though dev_get_stats() takes up the majority of the reading process,
>> the improvement is still significant;
>> And the improvement may vary with the physical interface on the system.
>> 
>> Signed-off-by: David Wang <00107082@....com>
>
>If the user-space is concerned with performances, it must use netlink.
>Optimizing a legacy interface gives IMHO a very wrong message.
>
>I'm sorry, I think we should not accept this change.

It's OK. 
I have been using /proc/net/dev to gauge the transmit/receive rate for each interface,
 and /proc/net/netstat for abnormalities in my monitoring tools.  I guess my knowledge are quite out of date now,
I will look into netlink; And thanks for information.

>
>/P

Thanks
David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ