mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
alpha: use __ratelimit
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: linux-alpha@vger.kernel.org Signed-off-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
committed by
Matt Turner
parent
3971047930
commit
2a238a9635
@@ -17,6 +17,7 @@
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/kallsyms.h>
|
#include <linux/kallsyms.h>
|
||||||
|
#include <linux/ratelimit.h>
|
||||||
|
|
||||||
#include <asm/gentrap.h>
|
#include <asm/gentrap.h>
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
@@ -771,8 +772,7 @@ asmlinkage void
|
|||||||
do_entUnaUser(void __user * va, unsigned long opcode,
|
do_entUnaUser(void __user * va, unsigned long opcode,
|
||||||
unsigned long reg, struct pt_regs *regs)
|
unsigned long reg, struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
static int cnt = 0;
|
static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5);
|
||||||
static unsigned long last_time;
|
|
||||||
|
|
||||||
unsigned long tmp1, tmp2, tmp3, tmp4;
|
unsigned long tmp1, tmp2, tmp3, tmp4;
|
||||||
unsigned long fake_reg, *reg_addr = &fake_reg;
|
unsigned long fake_reg, *reg_addr = &fake_reg;
|
||||||
@@ -783,15 +783,11 @@ do_entUnaUser(void __user * va, unsigned long opcode,
|
|||||||
with the unaliged access. */
|
with the unaliged access. */
|
||||||
|
|
||||||
if (!test_thread_flag (TIF_UAC_NOPRINT)) {
|
if (!test_thread_flag (TIF_UAC_NOPRINT)) {
|
||||||
if (cnt >= 5 && time_after(jiffies, last_time + 5 * HZ)) {
|
if (__ratelimit(&ratelimit)) {
|
||||||
cnt = 0;
|
|
||||||
}
|
|
||||||
if (++cnt < 5) {
|
|
||||||
printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n",
|
printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n",
|
||||||
current->comm, task_pid_nr(current),
|
current->comm, task_pid_nr(current),
|
||||||
regs->pc - 4, va, opcode, reg);
|
regs->pc - 4, va, opcode, reg);
|
||||||
}
|
}
|
||||||
last_time = jiffies;
|
|
||||||
}
|
}
|
||||||
if (test_thread_flag (TIF_UAC_SIGBUS))
|
if (test_thread_flag (TIF_UAC_SIGBUS))
|
||||||
goto give_sigbus;
|
goto give_sigbus;
|
||||||
|
Reference in New Issue
Block a user