]> sourceware.org Git - systemtap.git/commit
io_submit.stp: fix array membership test
authorJeff Moyer <jmoyer@redhat.com>
Fri, 11 May 2018 19:25:50 +0000 (15:25 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Mon, 28 May 2018 18:36:39 +0000 (14:36 -0400)
commitd32f1fabad036eb32371a759ec8b80ec12860743
treece82c2a5b0c1829187cc45e1d63ac70005bd9b47
parent0973594b45aaaa241dc6284270622ef80bd4ef95
io_submit.stp: fix array membership test

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
This page took 0.025719 seconds and 5 git commands to generate.