From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65C5EC433EF for ; Sat, 7 Sep 2019 22:46:02 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3532F21744 for ; Sat, 7 Sep 2019 22:46:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3532F21744 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=vt.edu Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.92.1) (envelope-from ) id 1i6jSi-0002Bg-TV; Sat, 07 Sep 2019 18:45:44 -0400 Received: from omr2.cc.ipv6.vt.edu ([2607:b400:92:8400:0:33:fb76:806e] helo=omr2.cc.vt.edu) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.1) (envelope-from ) id 1i6jSg-0002Ba-5c for kernelnewbies@kernelnewbies.org; Sat, 07 Sep 2019 18:45:42 -0400 Received: from mr4.cc.vt.edu (mr4.cc.vt.edu [IPv6:2607:b400:92:8300:0:7b:e2b1:6a29]) by omr2.cc.vt.edu (8.14.4/8.14.4) with ESMTP id x87MjeFg005999 for ; Sat, 7 Sep 2019 18:45:41 -0400 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mr4.cc.vt.edu (8.14.7/8.14.7) with ESMTP id x87MjZo7031623 for ; Sat, 7 Sep 2019 18:45:40 -0400 Received: by mail-qk1-f198.google.com with SMTP id w20so10456499qka.18 for ; Sat, 07 Sep 2019 15:45:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to:references :mime-version:content-transfer-encoding:date:message-id; bh=/6kA56aQB2rpYIanrtLDCa2hCGf5VimosArLW5oScDM=; b=N/doofCygrSzrfrMOyrlk9pbVY2DbyNkLro7bSYUhlqw8Sh8V0AqZPV68az4fzHoDC z0ZiNy/vKGvXrtjMLWfiZFinNMu+yj5GUw57owVpEGeYxOIUWAqDPwcKdw2AqGeIJBud W995OduRqox4QYEAS6SZ0lJ00A+Z6/ibVKy7tif+H1CR6saQl1FdR6kafOHbt9Fuaqic KJouq86/WpUoxjBDVONw6m90xzXTPoPgDwOnyjSrj2dgvn9IX8m+QFK1NELsSBj+UPa+ 5oQcLaOhJeL0N7YZm9IOnUFE5Yuf8FXOMvdBJrs4VF1nnffKFtBchxgxAjIk1watW5Jj LlLA== X-Gm-Message-State: APjAAAXhHq4JKQd1cem2wNM1koSEtNc+LlJ5emBvh/jXNU3LSBa723Xg q6r3d+r8a6/NrqcT0/pCzk/DvXmDzjWwlZVdgpNHo9IudO0hiM3l5sCX2TWXoAb0Rp7hL9n+V7C 1gpyLaltwoTLfPELlGRh964g8sJehWw8mommzpaE= X-Received: by 2002:ae9:f015:: with SMTP id l21mr15414575qkg.35.1567896335566; Sat, 07 Sep 2019 15:45:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCoUfhCNUjzUPYyc+PfkgUSd3QU8LrT71A/JqRfAqS/yaYDJKlaSf3EmKKI6wExKDziiSqCw== X-Received: by 2002:ae9:f015:: with SMTP id l21mr15414557qkg.35.1567896335317; Sat, 07 Sep 2019 15:45:35 -0700 (PDT) Received: from turing-police ([2601:5c0:c001:4341::359]) by smtp.gmail.com with ESMTPSA id n187sm4651747qkc.98.2019.09.07.15.45.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Sep 2019 15:45:33 -0700 (PDT) From: "Valdis Kl=?utf-8?Q?=c4=93?=tnieks" X-Google-Original-From: "Valdis Kl=?utf-8?Q?=c4=93?=tnieks" X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7+dev To: Theodore Dubois Subject: Re: perf_event wakeup_events = 0 In-Reply-To: <123C743E-C322-45DB-8796-BF6B6EE9CA80@google.com> References: <943813.1567863629@turing-police> <123C743E-C322-45DB-8796-BF6B6EE9CA80@google.com> Mime-Version: 1.0 Date: Sat, 07 Sep 2019 18:45:31 -0400 Message-ID: <972489.1567896331@turing-police> Cc: kernelnewbies@kernelnewbies.org, a.p.zijlstra@chello.nl, linux-kernel@vger.kernel.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============4418094279305137108==" Errors-To: kernelnewbies-bounces@kernelnewbies.org --===============4418094279305137108== Content-Type: multipart/signed; boundary="==_Exmh_1567896330_4251P"; micalg=pgp-sha1; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit --==_Exmh_1567896330_4251P Content-Type: text/plain; charset=us-ascii On Sat, 07 Sep 2019 09:14:49 -0700, Theodore Dubois said: Reading what it actually says rather than what I thought it said.. :) Events come in two flavors: counting and sampled. A counting event is one that is used for counting the aggregate number of events that occur. In general, counting event results are gathered with a read(2) call. A sampling event periodically writes measurements to a buffer that can then be accessed via mmap(2). For some reason, I was thinking counting events. -ENOCAFFEINE. :) > sample_freq is 4000 (and freq is 1). Here’s the man page on this field: > > sample_period, sample_freq > A "sampling" event is one that generates an overflow notifica‐ > tion every N events, where N is given by sample_period. A sam‐ > pling event has sample_period > 0. There's this part: > pling event has sample_period > 0. When an overflow occurs, > requested data is recorded in the mmap buffer. The sample_type > field controls what data is recorded on each overflow. So an entry is made in the buffer. It's not clear that this immediately triggers a signal... MMAP layout When using perf_event_open() in sampled mode, asynchronous events (like counter overflow or PROT_EXEC mmap tracking) are logged into a ring- buffer. This ring-buffer is created and accessed through mmap(2). The mmap size should be 1+2^n pages, where the first page is a metadata page (struct perf_event_mmap_page) that contains various bits of infor? mation such as where the ring-buffer head is. So you need to look at what size mmap buffer is being allocated. It's *probably* on the order of megabytes, so that you can buffer a fairly large number of entries and not take several user/kernel transitions on every single entry... > If I’m reading this right, this is a sampling event which overflows 4000 times a second. And 4,000 entries are made in the buffer per second.. > But perf then does a poll call which wakes up on this FD with POLLIN after > 1.637 seconds, instead of 0.00025 seconds At which point perf goes and looks at several thousand entries in the ring buffer... --==_Exmh_1567896330_4251P Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Comment: Exmh version 2.9.0 11/07/2018 iQIVAwUBXXQzCgdmEQWDXROgAQKDoxAAkZ+wx9S0PL9octbbGAiuxv0CpxWngMqC fEIT+8vDMnOoc15M4RlUUOtSsvsZ3NPjyqY1xJAx3WpW9735VQ3gS5KP/g8Th2r4 qus8R8bYrGyfumYGjMWimSkyxEauElyKHv+WjSmIzsWg9jtc5qdBhlFYuigu2TN7 /9I6WzUsGPxLIp39psSOWJO7YoC8y1DIPeyU9Tk+kUOBBZj76lQ6Z6zIT2Plb7R0 BRBq7wO6LqIiuC8Zg5UkyoyllXs8KNuFCtxMwYxUxeGtQe2i82U2UGQcBPigiv/F N5Jc4ps48o8xaVs0B+l8KKRJ3B/NmGw9nf1LXBeQgrgLhFxcbnm6q16sPkhiWyK2 diwcL7Xl2hbtAKDTozWWXgg0Iid+Dy9Qt6nQY6Li/XPWEiF4xV9CRED2qv/Y717x PCCDxTE9JhCng15yPBwR67cjWQYE7hNtxf06ZaaFHAHtiZju6UqCCpAfM9UiUzUh YEjRkMhAML3fS3G+NwJmjBBc71sBluNMMkPcmdX3E8aEnxkkMzeWN33klN5ux4bE WHGXAuCHe9wPybfHpbJo/xhHFwYSvAJfc7wKDS/AIiJimn5gGvMaah3e5fWqJLXp juIlpBc5P0pbJv51TWuuHYjZW4R0yRdpxlNfJtCFV9VPdR15SqQWMBJ5fAG/jdDh cCc9IpFngjo= =OaMg -----END PGP SIGNATURE----- --==_Exmh_1567896330_4251P-- --===============4418094279305137108== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --===============4418094279305137108==--