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>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.1.10.0901080916080.22642@gandalf.stny.rr.com>
Date:	Thu, 8 Jan 2009 09:17:22 -0500 (EST)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	akpm@...ux-foundation.org
cc:	mm-commits@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: + kernel-trace-ring_bufferc-use-div_round_up.patch added to -mm
 tree

> ------------------------------------------------------
> Subject: kernel/trace/ring_buffer.c: use DIV_ROUND_UP
> From: Andrew Morton <akpm@...ux-foundation.org>
> 
> Instead of open-coding it.
> 
> Cc: Ingo Molnar <mingo@...e.hu>
> Cc: Steven Rostedt <rostedt@...dmis.org>
> Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
> ---
> 
>  kernel/trace/ring_buffer.c |   17 +++++------------
>  1 file changed, 5 insertions(+), 12 deletions(-)
> 
> diff -puN kernel/trace/ring_buffer.c~kernel-trace-ring_bufferc-use-div_round_up kernel/trace/ring_buffer.c
> --- a/kernel/trace/ring_buffer.c~kernel-trace-ring_bufferc-use-div_round_up
> +++ a/kernel/trace/ring_buffer.c
> @@ -123,8 +123,7 @@ void ring_buffer_normalize_time_stamp(in
>  EXPORT_SYMBOL_GPL(ring_buffer_normalize_time_stamp);
>  
>  #define RB_EVNT_HDR_SIZE (sizeof(struct ring_buffer_event))
> -#define RB_ALIGNMENT_SHIFT	2
> -#define RB_ALIGNMENT		(1 << RB_ALIGNMENT_SHIFT)
> +#define RB_ALIGNMENT		4U
>  #define RB_MAX_SMALL_DATA	28
>  
>  enum {
> @@ -151,7 +150,7 @@ rb_event_length(struct ring_buffer_event
>  
>  	case RINGBUF_TYPE_DATA:
>  		if (event->len)
> -			length = event->len << RB_ALIGNMENT_SHIFT;
> +			length = event->len / RB_ALIGNMENT;

uh, shouldn't that be a * and not a / ?

-- Steve

>  		else
>  			length = event->array[0];
>  		return length + RB_EVNT_HDR_SIZE;
> @@ -931,15 +930,11 @@ rb_update_event(struct ring_buffer_event
>  		break;
>  
>  	case RINGBUF_TYPE_TIME_EXTEND:
> -		event->len =
> -			(RB_LEN_TIME_EXTEND + (RB_ALIGNMENT-1))
> -			>> RB_ALIGNMENT_SHIFT;
> +		event->len = DIV_ROUND_UP(RB_LEN_TIME_EXTEND, RB_ALIGNMENT);
>  		break;
>  
>  	case RINGBUF_TYPE_TIME_STAMP:
> -		event->len =
> -			(RB_LEN_TIME_STAMP + (RB_ALIGNMENT-1))
> -			>> RB_ALIGNMENT_SHIFT;
> +		event->len = DIV_ROUND_UP(RB_LEN_TIME_STAMP, RB_ALIGNMENT);
>  		break;
>  
>  	case RINGBUF_TYPE_DATA:
> @@ -948,9 +943,7 @@ rb_update_event(struct ring_buffer_event
>  			event->len = 0;
>  			event->array[0] = length;
>  		} else
> -			event->len =
> -				(length + (RB_ALIGNMENT-1))
> -				>> RB_ALIGNMENT_SHIFT;
> +			event->len = DIV_ROUND_UP(length, RB_ALIGNMENT);
>  		break;
>  	default:
>  		BUG();
> _
--
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