kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>
To: Theodore Dubois <tbodt@google.com>
Cc: kernelnewbies@kernelnewbies.org, a.p.zijlstra@chello.nl,
	linux-kernel@vger.kernel.org
Subject: Re: perf_event wakeup_events = 0
Date: Sat, 07 Sep 2019 09:40:29 -0400	[thread overview]
Message-ID: <943813.1567863629@turing-police> (raw)
In-Reply-To: <CAN3rvwA+Dnqj4O79f6rNfO50VjbAC3YwJ7CW2ze2aBLzkSJRgQ@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1827 bytes --]

On Fri, 06 Sep 2019 16:28:24 -0700, Theodore Dubois said:
> The man page for perf_event_open(2) says that recent kernels treat a 0
> value for wakeup_events the same as 1, which I believe means it will
> notify after a single sample. However, strace on perf(1) shows that it
> uses wakeup_events=0, and it's definitely not waking up on every
> sample (it seems to be waking up every few seconds.)
> tools/perf/design.txt says "Normally a notification is generated for
> every page filled". Is the documentation wrong, or am I
> misunderstanding something?

       wakeup_events, wakeup_watermark
              This  union sets how many samples (wakeup_events) or bytes (wakeup_watermark) happen before an overflow
              notification happens.  Which one is used is selected by the watermark bit flag.

              wakeup_events counts only PERF_RECORD_SAMPLE record types.  To receive overflow  notification  for  all
              PERF_RECORD types choose watermark and set wakeup_watermark to 1.

              Prior  to Linux 3.0, setting wakeup_events to 0 resulted in no overflow notifications; more recent ker?
              nels treat 0 the same as 1.

My reading of that is that in pre-3.0 kernels, you could choose to not get overflow
notifications, and now you'll get them whether or not you wanted them.

Under "overflow handling", we see:

       Overflows are generated only by sampling events (sample_period must have a nonzero value).

So the reason strace says perf is only waking up every few seconds is probably
because you either launched perf with options that only create trace events, or
it takes several seconds for an overflow to happen on a sampling event. A lot
of those fields are u64 counters, and won't overflow anytime soon.  Even the
u32 counters can take a few seconds to overflow....


[-- Attachment #1.2: Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply	other threads:[~2019-09-07 13:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06 23:28 perf_event wakeup_events = 0 Theodore Dubois
2019-09-07 13:40 ` Valdis Klētnieks [this message]
2019-09-07 16:14   ` Theodore Dubois
2019-09-07 22:00     ` Valdis Klētnieks
2019-09-07 22:45     ` Valdis Klētnieks
2019-09-07 23:27       ` Theodore Dubois

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=943813.1567863629@turing-police \
    --to=valdis.kletnieks@vt.edu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tbodt@google.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).