linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Theodore Y. Ts'o" <tytso@mit.edu>
To: Dmitry Safonov <dima@arista.com>
Cc: linux-kernel@vger.kernel.org, 0x7f454c46@gmail.com,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH 1/2] random: Omit double-printing ratelimit messages
Date: Thu, 10 May 2018 23:51:50 -0400	[thread overview]
Message-ID: <20180511035150.GJ8335@thunk.org> (raw)
In-Reply-To: <1525981807.28243.9.camel@arista.com>

On Thu, May 10, 2018 at 08:50:07PM +0100, Dmitry Safonov wrote:
> random uses __ratelimit() which calls ___ratelimit() with a function
> name. Depending on !RATELIMIT_MSG_ON_RELEASE it prints how many
> messages were suppressed every ratelimit interval (1 second for random)
> and flushes ratelimit_state::missed:

So the thing about the ratelimit system is that if you have a burst of
1,000,000 within the one second burst window, and then nothing ever
again, you will never see a message accounting for those 1,000,000
"callbacks" (which is a terrible wording; it just confuses people).

If you have a burst of 1,000,000 calls to ratelimit, and then a month
goes by, and *then* a single call to __ratelimit is called by printk,
only *the* does the message about the suppressed "callback" get
printed.

So in the case of the random driver, once the random driver is fully
intialized, there will never be a call to __ratelimit() for the
urandom ratelimit structures, so we manually print out the final
number of suppressed message so there is proper accounting for them.

It is not a double-count.  If we didn't do that, those suppressed
warnings would never be mentioned by the kernel.

Cheers,

						- Ted

  reply	other threads:[~2018-05-11  3:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-10 12:52 [PATCH 0/2] ratelimit: Do not lose messages under limit Dmitry Safonov
2018-05-10 12:52 ` [PATCH 1/2] random: Omit double-printing ratelimit messages Dmitry Safonov
2018-05-10 18:19   ` Theodore Y. Ts'o
2018-05-10 18:37     ` Dmitry Safonov
2018-05-10 19:40       ` Theodore Y. Ts'o
2018-05-10 19:50         ` Dmitry Safonov
2018-05-11  3:51           ` Theodore Y. Ts'o [this message]
2018-05-11 12:41             ` Dmitry Safonov
2018-05-16 15:46               ` Dmitry Safonov
2018-05-16 20:54                 ` Theodore Y. Ts'o
2018-05-16 22:11                   ` Dmitry Safonov
2018-05-10 12:52 ` [PATCH 2/2] lib/ratelimit: Lockless ratelimiting Dmitry Safonov

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=20180511035150.GJ8335@thunk.org \
    --to=tytso@mit.edu \
    --cc=0x7f454c46@gmail.com \
    --cc=arnd@arndb.de \
    --cc=dima@arista.com \
    --cc=linux-kernel@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).