From: Matt Turner <mattst88@gmail.com>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-kernel@vger.kernel.org, Richard Henderson <rth@twiddle.net>,
Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
linux-alpha@vger.kernel.org
Subject: Re: [PATCH] alpha: use __ratelimit
Date: Wed, 3 Mar 2010 00:32:20 -0500 [thread overview]
Message-ID: <b4198de61003022132q2c5f307cwaf9bd1d655ae5a4@mail.gmail.com> (raw)
In-Reply-To: <1267354697-6456-1-git-send-email-akinobu.mita@gmail.com>
On Sun, Feb 28, 2010 at 5:58 AM, Akinobu Mita <akinobu.mita@gmail.com> wrote:
> Replace open-coded rate limiting logic with __ratelimit().
>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> Cc: Matt Turner <mattst88@gmail.com>
> Cc: linux-alpha@vger.kernel.org
> ---
> arch/alpha/kernel/traps.c | 10 +++-------
> 1 files changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c
> index 6ee7655..b14f015 100644
> --- a/arch/alpha/kernel/traps.c
> +++ b/arch/alpha/kernel/traps.c
> @@ -17,6 +17,7 @@
> #include <linux/module.h>
> #include <linux/init.h>
> #include <linux/kallsyms.h>
> +#include <linux/ratelimit.h>
>
> #include <asm/gentrap.h>
> #include <asm/uaccess.h>
> @@ -771,8 +772,7 @@ asmlinkage void
> do_entUnaUser(void __user * va, unsigned long opcode,
> unsigned long reg, struct pt_regs *regs)
> {
> - static int cnt = 0;
> - static unsigned long last_time;
> + static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5);
>
> unsigned long tmp1, tmp2, tmp3, tmp4;
> unsigned long fake_reg, *reg_addr = &fake_reg;
> @@ -783,15 +783,11 @@ do_entUnaUser(void __user * va, unsigned long opcode,
> with the unaliged access. */
>
> if (!test_thread_flag (TIF_UAC_NOPRINT)) {
> - if (cnt >= 5 && time_after(jiffies, last_time + 5 * HZ)) {
> - cnt = 0;
> - }
> - if (++cnt < 5) {
> + if (__ratelimit(&ratelimit)) {
> printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n",
> current->comm, task_pid_nr(current),
> regs->pc - 4, va, opcode, reg);
> }
> - last_time = jiffies;
> }
> if (test_thread_flag (TIF_UAC_SIGBUS))
> goto give_sigbus;
> --
> 1.6.0.6
Thanks, applied.
Matt
prev parent reply other threads:[~2010-03-03 5:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-28 10:58 Akinobu Mita
2010-02-28 10:58 ` [PATCH] ia64: " Akinobu Mita
2010-02-28 10:58 ` [PATCH] parisc: " Akinobu Mita
2010-03-01 23:54 ` Kyle McMartin
2010-02-28 10:58 ` [PATCH] powerpc: " Akinobu Mita
2010-02-28 10:58 ` [PATCH] sparc: " Akinobu Mita
2010-02-28 11:31 ` David Miller
2010-02-28 18:42 ` [PATCH] alpha: " Joe Perches
2010-03-01 3:13 ` Akinobu Mita
2010-03-03 5:32 ` Matt Turner [this message]
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=b4198de61003022132q2c5f307cwaf9bd1d655ae5a4@mail.gmail.com \
--to=mattst88@gmail.com \
--cc=akinobu.mita@gmail.com \
--cc=ink@jurassic.park.msu.ru \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rth@twiddle.net \
/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
all inboxes | Powered by JetHome®