From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Joe Perches <joe@perches.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Sam Varshavchik <mrsam@courier-mta.com>,
Ingo Molnar <mingo@kernel.org>, Laura Abbott <labbott@redhat.com>,
Brent <fix@bitrealm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Christian Borntraeger <borntraeger@de.ibm.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [REGRESSION] RLIMIT_DATA crashes named
Date: Sat, 17 Sep 2016 12:09:41 +0300 [thread overview]
Message-ID: <20160917090941.GB26044@uranus.lan> (raw)
In-Reply-To: <CALYGNiNuF1Ggy=DyYG32HXbnJp3Q0cX9ekQ5w2jR1M9rkKaX9A@mail.gmail.com>
On Sat, Sep 17, 2016 at 11:33:56AM +0300, Konstantin Khlebnikov wrote:
> >
> > do_just_once just isn't a good name for a global
> > rate limited mechanism that does something very
> > different than the name.
> >
> > Maybe allow_once_per_ratelimit or the like
> >
> > There could be an equivalent do_once
> >
> > https://lkml.org/lkml/2009/5/22/3
> >
>
> What about this printk_reriodic() and pr_warn_once_per_minute()?
>
> It simply remembers next jiffies to print rather than using that
> complicated ratelimiting engine.
+#define printk_periodic(period, fmt, ...) \
+({ \
+ static unsigned long __print_next __read_mostly = INITIAL_JIFFIES; \
+ bool __do_print = time_after_eq(jiffies, __print_next); \
+ \
+ if (__do_print) { \
+ __print_next = jiffies + (period); \
+ printk(fmt, ##__VA_ARGS__); \
+ } \
+ unlikely(__do_print); \
+})
Seems I don't understand the bottom unlikely...
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Joe Perches <joe@perches.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Sam Varshavchik <mrsam@courier-mta.com>,
Ingo Molnar <mingo@kernel.org>, Laura Abbott <labbott@redhat.com>,
Brent <fix@bitrealm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Christian Borntraeger <borntraeger@de.ibm.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [REGRESSION] RLIMIT_DATA crashes named
Date: Sat, 17 Sep 2016 12:09:41 +0300 [thread overview]
Message-ID: <20160917090941.GB26044@uranus.lan> (raw)
In-Reply-To: <CALYGNiNuF1Ggy=DyYG32HXbnJp3Q0cX9ekQ5w2jR1M9rkKaX9A@mail.gmail.com>
On Sat, Sep 17, 2016 at 11:33:56AM +0300, Konstantin Khlebnikov wrote:
> >
> > do_just_once just isn't a good name for a global
> > rate limited mechanism that does something very
> > different than the name.
> >
> > Maybe allow_once_per_ratelimit or the like
> >
> > There could be an equivalent do_once
> >
> > https://lkml.org/lkml/2009/5/22/3
> >
>
> What about this printk_reriodic() and pr_warn_once_per_minute()?
>
> It simply remembers next jiffies to print rather than using that
> complicated ratelimiting engine.
+#define printk_periodic(period, fmt, ...) \
+({ \
+ static unsigned long __print_next __read_mostly = INITIAL_JIFFIES; \
+ bool __do_print = time_after_eq(jiffies, __print_next); \
+ \
+ if (__do_print) { \
+ __print_next = jiffies + (period); \
+ printk(fmt, ##__VA_ARGS__); \
+ } \
+ unlikely(__do_print); \
+})
Seems I don't understand the bottom unlikely...
next prev parent reply other threads:[~2016-09-17 9:09 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-16 15:16 [REGRESSION] RLIMIT_DATA crashes named Laura Abbott
2016-09-16 15:16 ` Laura Abbott
2016-09-16 17:46 ` Linus Torvalds
2016-09-16 17:46 ` Linus Torvalds
2016-09-16 20:10 ` Laura Abbott
2016-09-16 20:10 ` Laura Abbott
2016-09-16 20:32 ` Linus Torvalds
2016-09-16 20:32 ` Linus Torvalds
2016-09-16 22:30 ` Sam Varshavchik
2016-09-16 22:30 ` Sam Varshavchik
2016-09-16 23:58 ` Linus Torvalds
2016-09-17 0:04 ` Linus Torvalds
2016-09-17 0:04 ` Linus Torvalds
2016-09-17 4:08 ` Joe Perches
2016-09-17 4:08 ` Joe Perches
2016-09-17 8:33 ` Konstantin Khlebnikov
2016-09-17 9:09 ` Cyrill Gorcunov [this message]
2016-09-17 9:09 ` Cyrill Gorcunov
2016-09-17 12:09 ` Konstantin Khlebnikov
2016-09-17 12:09 ` Konstantin Khlebnikov
2016-09-17 12:20 ` Cyrill Gorcunov
2016-09-17 12:20 ` Cyrill Gorcunov
2016-09-17 21:40 ` Konstantin Khlebnikov
2016-09-17 21:52 ` Joe Perches
2016-09-17 21:52 ` Joe Perches
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=20160917090941.GB26044@uranus.lan \
--to=gorcunov@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=borntraeger@de.ibm.com \
--cc=fix@bitrealm.com \
--cc=joe@perches.com \
--cc=koct9i@gmail.com \
--cc=labbott@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@kernel.org \
--cc=mrsam@courier-mta.com \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.