From: Paolo Abeni <pabeni@redhat.com>
To: David Wang <00107082@163.com>,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net/core/net-procfs: use seq_put_decimal_ull_width() for decimal values in /proc/net/dev
Date: Thu, 14 Nov 2024 10:17:32 +0100 [thread overview]
Message-ID: <9e64f1ca-844f-47ec-8555-4ac1e409ec16@redhat.com> (raw)
In-Reply-To: <20241110045221.4959-1-00107082@163.com>
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@163.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.
/P
next prev parent reply other threads:[~2024-11-14 9:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-10 4:52 David Wang
2024-11-14 9:17 ` Paolo Abeni [this message]
2024-11-14 9:56 ` David Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9e64f1ca-844f-47ec-8555-4ac1e409ec16@redhat.com \
--to=pabeni@redhat.com \
--cc=00107082@163.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®