From: Arkady <arkady.miasnikov@gmail.com>
To: Kun <mingkunone@qq.com>
Cc: Serhei Makarov <smakarov@redhat.com>,
systemtap <systemtap@sourceware.org>
Subject: Re: Fwd: systemtap global var lead to high cpu
Date: Sat, 25 Jul 2020 08:25:17 +0300 [thread overview]
Message-ID: <CANA-60owxHd5+k9JczB5VLuWLSppyunHqA7gfa=M5GGLwS2svg@mail.gmail.com> (raw)
In-Reply-To: <tencent_43E6EEC6C8B4F3E539910550E6DCE4AA2309@qq.com>
On Sat, Jul 25, 2020 at 5:45 AM Kun <mingkunone@qq.com> wrote:
>
> Hi,
> How to embed your module into systemtap?
Try this
https://sourceware.org/systemtap/tutorial/4_Tapsets.html#SECTION00053000000000000000
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/systemtap_language_reference/ch03s06
> it prompts some error when i run dup_probe.stp,
> semantic error:while resolving probe point: identifier ‘kernel’ at kprocess.stp:29:25
> Source: probe kprocess.creat = kernel.function(“copy_process”).return
Please send the whole probe
> Thank you
>
>
>
> ------------------ Original ------------------
> From: Arkady <arkady.miasnikov@gmail.com>
> Date: Fri,Jul 24,2020 11:49 AM
> To: Kun <mingkunone@qq.com>
> Cc: Serhei Makarov <smakarov@redhat.com>, systemtap <systemtap@sourceware.org>
> Subject: Re: Fwd: systemtap global var lead to high cpu
>
> Hi Kun,
>
> I avoid locks by using lockless data structures. For example, I have
> my own hashtables instead of associative arrays.
> You can check this code for inspiration
> https://github.com/larytet/lockfree_hashtable
>
> If the performance is paramount for your task you can switch to 100%
> handwritten C code.
>
> Arkady,
>
> On Fri, Jul 24, 2020 at 5:01 AM Kun via Systemtap
> <systemtap@sourceware.org> wrote:
> >
> > My global var saved is string type, not number, so I can not use aggregate.
> > FChE will fixed this bug,
> > https://sourceware.org/bugzilla/show_bug.cgi?id=26296
> > Hoping to fixed soon.
> >
> >
> >
> >
> > ------------------ Original ------------------
> > From: Serhei Makarov <smakarov@redhat.com>
> > Date: Thu,Jul 23,2020 10:22 PM
> > To: systemtap <systemtap@sourceware.org>, mingkunone <mingkunone@qq.com>
> > Subject: Re: Fwd: systemtap global var lead to high cpu
> >
> >
> >
> > Forwarding your question to systemtap@sourceware.org in case other people have suggestions.
> >
> >
> >
> > In general, the locks protect concurrent modifications from interfering with each other when different processes trigger the same probe.
> >
> >
> > Depending on what you want to do with the iphdr value, you may be able to reduce contention by using statistical aggregates
> > (which do not require locking). For example, aaa[iphdr] <<< some_statistic; in a later probe iterate through aaa. A lot of the SystemTap example scripts use this type of structure, for example: https://sourceware.org/systemtap/examples/network/netfilter_summary.stp
> >
> >
> > Otherwise, every tcp_ack() for every packet on your system will try to grab the same lock. The resulting CPU load is unsurprising to me.
> >
> >
> > Hope this information is helpful; if not, someone else may have a better suggestion.
> >
> >
> > All the best,
> > Serhei
> >
> >
> > ---------- Forwarded message ---------
> > From: Kun <mingkunone@qq.com>
> > Date: Wed, Jul 22, 2020 at 11:24 PM
> > Subject: systemtap global var lead to high cpu
> > To: smakarov <smakarov@redhat.com>
> >
> >
> >
> > Hi,
> > I have a problem of system tap which
> > Using global var.
> > A simple demo as following,
> > Global aaa
> > Probe kernel.function(“tcp_ack”){
> > Iphdr = __get_skb_iphdr($skb)
> > If(iphdr == 0){
> > aaa=iphdr
> > }
> >
> >
> > Then our env have a 10Gbps flow, and our cpu is nearly 100%.
> >
> >
> > Analysising c code, I find this is because of a lock as following:
> > Static void probe_6330()
> > {
> > If(sta_lock_probe(lock, ARRAY_SIZE(locks))
> > Return;
> > If(l->iphdr == 0){
> > Global(s_global_aaa)=l->l_iphdr;
> > }
> >
> >
> > My question is that aaa should be protected in “if”,
> > Why is the lock directly at the function entry?
next prev parent reply other threads:[~2020-07-25 5:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-24 2:00 Kun
2020-07-24 3:49 ` Arkady
2020-07-25 2:45 ` Kun
2020-07-25 5:25 ` Arkady [this message]
2020-08-18 19:11 ` Frank Ch. Eigler
[not found] <tencent_FB0905D58DA3FA7F0E728C535B447E0D1905@qq.com>
2020-07-23 14:22 ` Serhei Makarov
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='CANA-60owxHd5+k9JczB5VLuWLSppyunHqA7gfa=M5GGLwS2svg@mail.gmail.com' \
--to=arkady.miasnikov@gmail.com \
--cc=mingkunone@qq.com \
--cc=smakarov@redhat.com \
--cc=systemtap@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).