Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932897AbZJ3Vp6 (ORCPT ); Fri, 30 Oct 2009 17:45:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757447AbZJ3Vp4 (ORCPT ); Fri, 30 Oct 2009 17:45:56 -0400 Received: from mail.perches.com ([173.55.12.10]:1131 "EHLO mail.perches.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757305AbZJ3Vpz (ORCPT ); Fri, 30 Oct 2009 17:45:55 -0400 Subject: Re: [PATCH] show message when exceeded rlimit of pending signals From: Joe Perches To: Andrew Morton Cc: Naohiro Ooiwa , Ingo Molnar , Hiroshi Shimamoto , roland@redhat.com, Peter Zijlstra , Thomas Gleixner , LKML , oleg@redhat.com In-Reply-To: <20091030143333.414ea29c.akpm@linux-foundation.org> References: <4AEACFBF.4060108@miraclelinux.com> <20091030143333.414ea29c.akpm@linux-foundation.org> Content-Type: text/plain; charset="UTF-8" Date: Fri, 30 Oct 2009 14:45:58 -0700 Message-ID: <1256939158.1917.43.camel@Joe-Laptop.home> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1287 Lines: 43 On Fri, 2009-10-30 at 14:33 -0700, Andrew Morton wrote: > On Fri, 30 Oct 2009 20:36:31 +0900 > Naohiro Ooiwa wrote: > > +static void show_reach_rlimit_sigpending(void) > > + if (!printk_ratelimit()) > > + return; > > printk_ratelimit() is a bad thing and we should be working toward > removing it altogether, not adding new callers. > > Because it uses global state. So if subsystem A is trying to generate > lots of printk's, subsystem B's important message might get > accidentally suppressed. http://lkml.org/lkml/2009/9/21/323 I think there should be a generic kernel.h macro for this. Something like: #define printk_ratelimited(fmt, arg...) \ ({ static struct ratelimit_state _rs = { \ .interval = DEFAULT_RATELIMIT_INTERVAL, \ .burst = DEFAULT_RATELIMIT_BURST, \ }; \ int rtn; \ \ if (!__ratelimit(&_rs)) \ rtn = printk(fmt, ##arg); \ else \ rtn = 0; \ rtn; \ }) #define pr_info_rl(fmt, arg) \ printk_ratelimited(KERN_INFO pr_fmt(fmt), ##arg) etc... -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/