From patchwork Sun Feb 28 10:58:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 82793 X-Patchwork-Delegate: kyle@mcmartin.ca Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1SB0NgA012872 for ; Sun, 28 Feb 2010 11:00:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031800Ab0B1K7q (ORCPT ); Sun, 28 Feb 2010 05:59:46 -0500 Received: from mail-iw0-f182.google.com ([209.85.223.182]:51694 "EHLO mail-iw0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031793Ab0B1K7F (ORCPT ); Sun, 28 Feb 2010 05:59:05 -0500 Received: by mail-iw0-f182.google.com with SMTP id 12so1589776iwn.21 for ; Sun, 28 Feb 2010 02:59:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=Ij/B91jgpnfzSrwMUIP9Oa+1Uh7eSDTlptshQrV9lIQ=; b=RQZlFdb/TxHZbCP82J0C4p0RuqIH88nzXKWRx/sc2XY+wRpNM2Gyf3x3k16Zdm0B2G rToTuA4hAEo59Jtesxwcxfh3yDziRATsBn3N5kdnsxOy4O6UprOYU8bX1Yi4bRhe+YHL mcdIrCU3yG+htOkB3p1rl9Ctuwumum6wASNqk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=WlRPYbIT1Iqqp43oSMQQ/ebRuzzoOWJheFBEUoHxcCgcK818NlPTr9wm4CS9JG1vbb KvcUs0TIs931iLzvoNuPULxZpA7tMP5SI+1pvoZeAZut2iN/9ReNsZxY162VE4+6vM73 NkjqIcD38h0V0iFsAUROIqa/U+C3BHLsI8XdU= Received: by 10.231.151.207 with SMTP id d15mr1609187ibw.44.1267354744898; Sun, 28 Feb 2010 02:59:04 -0800 (PST) Received: from localhost (p12140-adsao01yokonib1-acca.kanagawa.ocn.ne.jp [61.199.6.140]) by mx.google.com with ESMTPS id 22sm1924894iwn.8.2010.02.28.02.59.03 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 28 Feb 2010 02:59:04 -0800 (PST) From: Akinobu Mita To: linux-kernel@vger.kernel.org Cc: Akinobu Mita , Kyle McMartin , Helge Deller , "James E.J. Bottomley" , linux-parisc@vger.kernel.org Subject: [PATCH] parisc: use __ratelimit Date: Sun, 28 Feb 2010 19:58:15 +0900 Message-Id: <1267354697-6456-3-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 1.6.0.6 In-Reply-To: <1267354697-6456-1-git-send-email-akinobu.mita@gmail.com> References: <1267354697-6456-1-git-send-email-akinobu.mita@gmail.com> Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 28 Feb 2010 11:00:24 +0000 (UTC) diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c index e6f4b7a..92d977b 100644 --- a/arch/parisc/kernel/unaligned.c +++ b/arch/parisc/kernel/unaligned.c @@ -25,6 +25,7 @@ #include #include #include +#include #include /* #define DEBUG_UNALIGNED 1 */ @@ -446,8 +447,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop) void handle_unaligned(struct pt_regs *regs) { - static unsigned long unaligned_count = 0; - static unsigned long last_time = 0; + static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5); unsigned long newbase = R1(regs->iir)?regs->gr[R1(regs->iir)]:0; int modify = 0; int ret = ERR_NOTHANDLED; @@ -460,14 +460,8 @@ void handle_unaligned(struct pt_regs *regs) goto force_sigbus; } - if (unaligned_count > 5 && - time_after(jiffies, last_time + 5 * HZ)) { - unaligned_count = 0; - last_time = jiffies; - } - - if (!(current->thread.flags & PARISC_UAC_NOPRINT) - && ++unaligned_count < 5) { + if (!(current->thread.flags & PARISC_UAC_NOPRINT) && + __ratelimit(&ratelimit)) { char buf[256]; sprintf(buf, "%s(%d): unaligned access to 0x" RFMT " at ip=0x" RFMT "\n", current->comm, task_pid_nr(current), regs->ior, regs->iaoq[0]);