From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f69.google.com (mail-lf0-f69.google.com [209.85.215.69]) by kanga.kvack.org (Postfix) with ESMTP id C1E106B0069 for ; Sat, 17 Sep 2016 05:09:45 -0400 (EDT) Received: by mail-lf0-f69.google.com with SMTP id k12so89594782lfb.2 for ; Sat, 17 Sep 2016 02:09:45 -0700 (PDT) Received: from mail-lf0-x233.google.com (mail-lf0-x233.google.com. [2a00:1450:4010:c07::233]) by mx.google.com with ESMTPS id 4si5572456lfh.19.2016.09.17.02.09.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Sep 2016 02:09:44 -0700 (PDT) Received: by mail-lf0-x233.google.com with SMTP id l131so76056614lfl.2 for ; Sat, 17 Sep 2016 02:09:44 -0700 (PDT) Date: Sat, 17 Sep 2016 12:09:41 +0300 From: Cyrill Gorcunov Subject: Re: [REGRESSION] RLIMIT_DATA crashes named Message-ID: <20160917090941.GB26044@uranus.lan> References: <33304dd8-8754-689d-11f3-751833b4a288@redhat.com> <1474085296.32273.95.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: Konstantin Khlebnikov Cc: Joe Perches , Linus Torvalds , Sam Varshavchik , Ingo Molnar , Laura Abbott , Brent , Andrew Morton , Christian Borntraeger , "linux-mm@kvack.org" , Linux Kernel Mailing List 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: email@kvack.org