From: Jiri Wiesner <jwiesner@suse.de>
To: Julian Anastasov <ja@ssi.bg>
Cc: Simon Horman <horms@verge.net.au>,
lvs-devel@vger.kernel.org,
yunhong-cgl jiang <xintian1976@gmail.com>,
dust.li@linux.alibaba.com
Subject: Re: [RFC PATCH 0/4] Use kthreads for stats
Date: Thu, 8 Sep 2022 20:32:34 +0200 [thread overview]
Message-ID: <20220908183234.GI18621@incl> (raw)
In-Reply-To: <20220908153521.GG18621@incl>
On Thu, Sep 08, 2022 at 05:35:21PM +0200, Jiri Wiesner wrote:
> There is an alternative design where you could increase kd->est_max_count for all kthreads once all of the available kthreads have kd->est_max_count estimators. Nevertheless, there would also have to be a limit to the value of kd->est_max_count. Imagine the estimation during a single tick would take so long that the gap variable in ip_vs_estimation_kthread() would become negative. You would need to have circa 250,000 estimators per kthread. Since you are already measuring the timeout you need for schedule_timeout() in ip_vs_estimation_kthread(), it should be possible to set the kd->est_max_count limit based on the maximum processing time per chain. It could be half a IPVS_EST_TICK, for example.
>
> But it seems to me that the alternative design - increasing kd->est_max_count - should have some support in what is used in production. Are there servers with more than 983,040 estimators (which would be IPVS_EST_MAX_COUNT * 30 kthreads) or even one third of that?
I did some profiling (but could have just looked at top, actually) of a kthread with IPVS_EST_MAX_COUNT estimators for 100 seconds:
# Samples: 4K of event 'bus-cycles'
# Event count (approx.): 125024900
# Overhead Period Command Shared Object Symbol
# ........ ............ ............... ................. .........................................
#
76.44% 95570475 ipvs-e:0:0 [kernel.kallsyms] [k] ip_vs_estimation_kthread
8.75% 10935925 ipvs-e:0:0 [kernel.kallsyms] [k] _find_next_bit
3.18% 3978975 swapper [kernel.kallsyms] [k] intel_idle
1.00% 1251250 ipvs-e:0:0 [kernel.kallsyms] [k] _raw_spin_lock_bh
0.36% 450450 swapper [kernel.kallsyms] [k] _raw_spin_lock
0.36% 450450 swapper [kernel.kallsyms] [k] update_rq_clock
The bus-cycles event on this particular machine makes 25,000,000 events per second. Based on the period in the profile, the CPU utilization for various functions is:
ip_vs_estimation_kthread: 95570475/100/25000000*100 = 3.82%
_find_next_bit: 10935925/100/25000000*100 = 0.44%
_raw_spin_lock_bh: 1251250/100/25000000*100 = 0.05%
The kthread could definitely utilize the CPU more, which is an argument for increasing kd->est_max_count.
--
Jiri Wiesner
SUSE Labs
prev parent reply other threads:[~2022-09-08 18:32 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-27 17:41 [RFC PATCH 0/4] Use kthreads for stats Julian Anastasov
2022-08-27 17:41 ` [RFC PATCH 1/4] ipvs: add rcu protection to stats Julian Anastasov
2022-09-05 10:43 ` Jiri Wiesner
2022-08-27 17:41 ` [RFC PATCH 2/4] ipvs: use kthreads for stats estimation Julian Anastasov
2022-09-05 6:47 ` dust.li
2022-09-07 18:07 ` Julian Anastasov
2022-09-05 13:19 ` Jiri Wiesner
2022-09-07 19:01 ` Julian Anastasov
2022-09-08 16:00 ` Jiri Wiesner
2022-08-27 17:41 ` [RFC PATCH 3/4] ipvs: add est_cpulist and est_nice sysctl vars Julian Anastasov
2022-09-05 14:53 ` Jiri Wiesner
2022-08-27 17:41 ` [RFC PATCH 4/4] ipvs: run_estimation should control the kthread tasks Julian Anastasov
2022-09-05 14:57 ` Jiri Wiesner
2022-09-05 6:34 ` [RFC PATCH 0/4] Use kthreads for stats dust.li
2022-09-05 8:26 ` Jiri Wiesner
2022-09-07 18:33 ` Julian Anastasov
2022-09-08 15:35 ` Jiri Wiesner
2022-09-08 18:32 ` Jiri Wiesner [this message]
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=20220908183234.GI18621@incl \
--to=jwiesner@suse.de \
--cc=dust.li@linux.alibaba.com \
--cc=horms@verge.net.au \
--cc=ja@ssi.bg \
--cc=lvs-devel@vger.kernel.org \
--cc=xintian1976@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).