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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20071113.195549.181119456.davem@davemloft.net>
Date:	Tue, 13 Nov 2007 19:55:49 -0800 (PST)
From:	David Miller <davem@...emloft.net>
To:	haoki@...hat.com
Cc:	herbert@...dor.apana.org.au, netdev@...r.kernel.org,
	satoshi.oshima.fk@...achi.com, andi@...stfloor.org,
	shemminger@...ux-foundation.org, johnpol@....mipt.ru,
	yoshfuji@...ux-ipv6.org, yumiko.sugita.yf@...achi.com
Subject: Re: [PATCH 2/5] accounting unit and variable

From: Hideo AOKI <haoki@...hat.com>
Date: Tue, 13 Nov 2007 22:27:13 -0500

> Herbert Xu wrote:
> > On Mon, Oct 29, 2007 at 05:23:10PM -0400, Hideo AOKI wrote:
> >>  
> >> +#define SK_DATAGRAM_MEM_QUANTUM ((int)PAGE_SIZE)
> >> +
> >> +static inline int sk_datagram_pages(int amt)
> >> +{
> >> +	return DIV_ROUND_UP(amt, SK_DATAGRAM_MEM_QUANTUM);
> >> +}
> > 
> > Does this really have to be int? Unsigned would let the compiler
> > optimise this to a simple shift.
> 
> Thank you for the comment.
> 
> This inline function is used to calculate the first argument of atomic_add()
> and atomic_sub(). Since the argument is int, I believe that using int is
> better than using unsigned int.

If you know the values will always be positive, as you will know here,
it is OK to us unsigned int here and avoids the unacceptable expensive
divide instruction.

Please fix this.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ