From: Jeff Moyer <jmoyer@redhat.com>
To: systemtap@sourceware.org
Cc: Jeff Moyer <jmoyer@redhat.com>
Subject: [PATCH 1/3] io_submit.stp: fix array membership test
Date: Fri, 11 May 2018 19:25:00 -0000 [thread overview]
Message-ID: <20180511192552.12849-2-jmoyer@redhat.com> (raw)
In-Reply-To: <20180511192552.12849-1-jmoyer@redhat.com>
io_submit.stp keeps track of threads which are currently executing
in the io_submit system call like so:
probe syscall.io_submit {
in_iosubmit[tid()] = 1
}
probe syscall.io_submit.return {
/* this assumes a given proc will do lots of io_submit calls, and
* so doesn't do the more expensive "delete in_iosubmit[p]". If
* there are lots of procs doing small number of io_submit calls,
* the hash may grow pretty big, so using delete may be better
*/
in_iosubmit[tid()] = 0
}
However, the test to see if a thread is currently executing in io_submit
is performed using the membership operator 'in':
if (tid() in in_iosubmit)
This is obviously wrong. We can do one of two things:
1) change the test to if (in_iosubmit[tid()] == 1) or
2) just perform the delete in the return probe
While I agree that we typically have a small number of threads performing
io_submit, I don't believe there is substance to the performance claims
for the delete operator. So, I've opted for solution 2.
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
---
testsuite/systemtap.examples/io/io_submit.stp | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/testsuite/systemtap.examples/io/io_submit.stp b/testsuite/systemtap.examples/io/io_submit.stp
index 74ab639..c5edd66 100755
--- a/testsuite/systemtap.examples/io/io_submit.stp
+++ b/testsuite/systemtap.examples/io/io_submit.stp
@@ -28,12 +28,7 @@ probe syscall.io_submit {
* when we return from sys_io_submit, record that we're no longer there
*/
probe syscall.io_submit.return {
- /* this assumes a given proc will do lots of io_submit calls, and
- * so doesn't do the more expensive "delete in_iosubmit[p]". If
- * there are lots of procs doing small number of io_submit calls,
- * the hash may grow pretty big, so using delete may be better
- */
- in_iosubmit[tid()] = 0
+ delete in_iosubmit[tid()]
}
/*
--
2.8.2.335.g4bb51ae
prev parent reply other threads:[~2018-05-11 19:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-11 19:25 io_submit.stp: various fixes Jeff Moyer
2018-05-11 19:25 ` [PATCH 3/3] io_submit.stp: let the user know when the script is loaded Jeff Moyer
2018-05-28 18:41 ` Frank Ch. Eigler
2018-05-29 15:01 ` Jeff Moyer
2018-05-11 19:25 ` [PATCH 2/3] io_submit.stp: use an accumulator for traces Jeff Moyer
2018-05-11 19:25 ` Jeff Moyer [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=20180511192552.12849-2-jmoyer@redhat.com \
--to=jmoyer@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).