linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Milian Wolff <milian.wolff@kdab.com>
To: linux-perf-users@vger.kernel.org
Subject: Duplication of sched events
Date: Thu, 06 Oct 2016 18:14:16 +0200	[thread overview]
Message-ID: <2304161.71JrnPZhhs@milian-kdab2> (raw)

[-- Attachment #1: Type: text/plain, Size: 3792 bytes --]

Hey all,

I noticed the following strange behavior, which applies to most of the sched 
trace events, most notably sched_wakeup and sched_stat_*:

~~~~~~~~
#include <unistd.h>

int main()
{
   for (int i = 0; i < 100; ++i) {
       usleep(10);
   }
}
~~~~~~~~

~~~~~~~~
$ perf record -e sched:sched_wakeup --event=syscalls:sys_{enter,exit}
_nanosleep ./a.out
           a.out 16841 [007] 24360.139137: syscalls:sys_enter_nanosleep: rqtp: 
0x7ffda95e0c20, rmtp: 0x00000000
         swapper     0 [007] 24360.139201:           sched:sched_wakeup: 
a.out:16841 [120] success=1 CPU:007
         swapper     0 [007] 24360.139201:           sched:sched_wakeup: 
a.out:16841 [120] success=1 CPU:007
         swapper     0 [007] 24360.139202:           sched:sched_wakeup: 
a.out:16841 [120] success=1 CPU:007
         swapper     0 [007] 24360.139202:           sched:sched_wakeup: 
a.out:16841 [120] success=1 CPU:007
         swapper     0 [007] 24360.139202:           sched:sched_wakeup: 
a.out:16841 [120] success=1 CPU:007
         swapper     0 [007] 24360.139202:           sched:sched_wakeup: 
a.out:16841 [120] success=1 CPU:007
         swapper     0 [007] 24360.139203:           sched:sched_wakeup: 
a.out:16841 [120] success=1 CPU:007
         swapper     0 [007] 24360.139203:           sched:sched_wakeup: 
a.out:16841 [120] success=1 CPU:007
           a.out 16841 [007] 24360.139206:  syscalls:sys_exit_nanosleep: 0x0
           a.out 16841 [007] 24360.139206: syscalls:sys_enter_nanosleep: rqtp: 
0x7ffda95e0c20, rmtp: 0x00000000
         swapper     0 [007] 24360.139267:           sched:sched_wakeup: 
a.out:16841 [120] success=1 CPU:007
         swapper     0 [007] 24360.139268:           sched:sched_wakeup: 
a.out:16841 [120] success=1 CPU:007
         swapper     0 [007] 24360.139268:           sched:sched_wakeup: 
a.out:16841 [120] success=1 CPU:007
         swapper     0 [007] 24360.139268:           sched:sched_wakeup: 
a.out:16841 [120] success=1 CPU:007
         swapper     0 [007] 24360.139268:           sched:sched_wakeup: 
a.out:16841 [120] success=1 CPU:007
         swapper     0 [007] 24360.139269:           sched:sched_wakeup: 
a.out:16841 [120] success=1 CPU:007
         swapper     0 [007] 24360.139269:           sched:sched_wakeup: 
a.out:16841 [120] success=1 CPU:007
         swapper     0 [007] 24360.139269:           sched:sched_wakeup: 
a.out:16841 [120] success=1 CPU:007
           a.out 16841 [007] 24360.139270:  syscalls:sys_exit_nanosleep: 0x0
...
# repeated like this
~~~~~~

Note how I get eight sched_wakeup events, all for the same cpu. This seems to 
be related to the number of cores on my system:

~~~~~
$ nproc
8
~~~~~

On a quad-core machine, I get them four times.

Interestingly, tracing system-wide "fixes" this behavior:

~~~~~
$ perf record -e sched:sched_wakeup --event=syscalls:sys_{enter,exit}
_nanosleep -a ./a.out
$ perf script |& grep a.out | head
           a.out 16978 [006] 24514.874484: syscalls:sys_enter_nanosleep: rqtp: 
0x7ffc44f450e0, rmtp: 0x00000000
         swapper     0 [006] 24514.874547:           sched:sched_wakeup: 
a.out:16978 [120] success=1 CPU:006
           a.out 16978 [006] 24514.874549:  syscalls:sys_exit_nanosleep: 0x0
           a.out 16978 [006] 24514.874549: syscalls:sys_enter_nanosleep: rqtp: 
0x7ffc44f450e0, rmtp: 0x00000000
         swapper     0 [006] 24514.874611:           sched:sched_wakeup: 
a.out:16978 [120] success=1 CPU:006
           a.out 16978 [006] 24514.874612:  syscalls:sys_exit_nanosleep: 0x0
~~~~~

I think this is a bug. Can someone clarify where it could come from, then I 
could try to fix it.

Thanks
-- 
Milian Wolff | milian.wolff@kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt Experts

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5903 bytes --]

                 reply	other threads:[~2016-10-06 16:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=2304161.71JrnPZhhs@milian-kdab2 \
    --to=milian.wolff@kdab.com \
    --cc=linux-perf-users@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;
as well as URLs for NNTP newsgroup(s).