[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20071114034550.GA9624@gondor.apana.org.au>
Date: Wed, 14 Nov 2007 11:45:50 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Hideo AOKI <haoki@...hat.com>
Cc: David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Satoshi Oshima <satoshi.oshima.fk@...achi.com>,
Andi Kleen <andi@...stfloor.org>,
Stephen Hemminger <shemminger@...ux-foundation.org>,
Evgeniy Polyakov <johnpol@....mipt.ru>,
yoshfuji@...ux-ipv6.org,
Yumiko Sugita <yumiko.sugita.yf@...achi.com>
Subject: Re: [PATCH 2/5] accounting unit and variable
On Tue, Nov 13, 2007 at 10:27:13PM -0500, Hideo AOKI wrote:
>
> Herbert Xu 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.
That doesn't really answer my question. Is this quantity ever
negative? If not you should make it unsigned for the reason I
gave above.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
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