Re: [REGRESSION] RLIMIT_DATA crashes named

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]