lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140506112602.GE9291@quack.suse.cz>
Date:	Tue, 6 May 2014 13:26:02 +0200
From:	Jan Kara <jack@...e.cz>
To:	John Stultz <john.stultz@...aro.org>
Cc:	LKML <linux-kernel@...r.kernel.org>, Jan Kara <jack@...e.cz>,
	Peter Zijlstra <peterz@...radead.org>,
	Jiri Bohac <jbohac@...e.cz>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH 3/4] printk: Add printk_deferred_once

On Mon 05-05-14 13:47:43, John Stultz wrote:
> Two of the three prink_deferred uses are really printk_once style
> uses, so add a printk_deferred_once macro to simplify those call
> sites.
> 
> Cc: Jan Kara <jack@...e.cz>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Jiri Bohac <jbohac@...e.cz>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Steven Rostedt <rostedt@...dmis.org>
> Reviewed-by: Steven Rostedt <rostedt@...dmis.org>
> Signed-off-by: John Stultz <john.stultz@...aro.org>
  The patch looks good. You can add:
Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> ---
>  include/linux/printk.h  | 11 +++++++++++
>  kernel/sched/deadline.c |  7 +------
>  kernel/sched/rt.c       |  8 +-------
>  3 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index 7847301..f086d6c 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -266,9 +266,20 @@ extern asmlinkage void dump_stack(void) __cold;
>  		printk(fmt, ##__VA_ARGS__);			\
>  	}							\
>  })
> +#define printk_deferred_once(fmt, ...)				\
> +({								\
> +	static bool __print_once __read_mostly;			\
> +								\
> +	if (!__print_once) {					\
> +		__print_once = true;				\
> +		printk_deferred(fmt, ##__VA_ARGS__);		\
> +	}							\
> +})
>  #else
>  #define printk_once(fmt, ...)					\
>  	no_printk(fmt, ##__VA_ARGS__)
> +#define printk_deferred_once(fmt, ...)				\
> +	no_printk(fmt, ##__VA_ARGS__)
>  #endif
>  
>  #define pr_emerg_once(fmt, ...)					\
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 657ed68..80837e9 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -348,12 +348,7 @@ static void replenish_dl_entity(struct sched_dl_entity *dl_se,
>  	 * entity.
>  	 */
>  	if (dl_time_before(dl_se->deadline, rq_clock(rq))) {
> -		static bool lag_once = false;
> -
> -		if (!lag_once) {
> -			lag_once = true;
> -			printk_deferred("sched: DL replenish lagged to much\n");
> -		}
> +		printk_deferred_once("sched: DL replenish lagged to much\n");
>  		dl_se->deadline = rq_clock(rq) + pi_se->dl_deadline;
>  		dl_se->runtime = pi_se->dl_runtime;
>  	}
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index e7dc728..ea4d500 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -890,14 +890,8 @@ static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq)
>  		 * but accrue some time due to boosting.
>  		 */
>  		if (likely(rt_b->rt_runtime)) {
> -			static bool once = false;
> -
>  			rt_rq->rt_throttled = 1;
> -
> -			if (!once) {
> -				once = true;
> -				printk_deferred("sched: RT throttling activated\n");
> -			}
> +			printk_deferred_once("sched: RT throttling activated\n");
>  		} else {
>  			/*
>  			 * In case we did anyway, make it go away,
> -- 
> 1.9.1
> 
-- 
Jan Kara <jack@...e.cz>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ